[GHC] #7600: cgrun044 failing with LLVM backend

GHC cvs-ghc at haskell.org
Thu Jan 17 05:06:19 CET 2013

#7600: cgrun044 failing with LLVM backend
Reporter:  dterei              |          Owner:  dterei          
    Type:  bug                 |         Status:  new             
Priority:  normal              |      Component:  Compiler (LLVM) 
 Version:  7.7                 |       Keywords:                  
      Os:  Unknown/Multiple    |   Architecture:  Unknown/Multiple
 Failure:  Compile-time crash  |      Blockedby:                  
Blocking:                      |        Related:                  
 test case cgrun044 fails currently with the LLVM backend. I believe this
 started with the switch to the new-code-generator.

 LLVM fails to compile the file due to an invalid floating point constant:

 /Users/davidt/bin/opt: Bug31.ll:23:155: error: floating point constant
 invalid for type
 @Bug31_floatzunumber_closure =  global
 %Bug31_floatzunumber_closure_struct<{i64 ptrtoint ([0 x i64]*
 @ghczmprim_GHCziTypes_Fzh_static_info to i64), float 0x7F800000, i32 0}>

 This is an old, annoying bug needing to be fixed for about the third time.
 Basically, LLVM requires all floating points (float, doubles...) be
 printed in IEEE 754 Double format, even single precision numbers (float).
 However, it expects types labeled float to be representable in IEEE 754
 Single precision format...

 So what we do is store all floating point numbers as Double and then
 narrow those that are Float by trying to do 'Double -> Float -> Double'.
 Then we can use the same machinery to produce the output for LLVM.

 Annoying, GHC seems to like to optimize away these narrowing operations.
 If it should or shouldn't do that is questionable. I'd argue it shouldn't,
 but oh well.

 The new-code-generator seems to have defeated existing techniques for
 stopping the optimizer firing.

Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7600>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

More information about the ghc-tickets mailing list