#1916: compiling truncate :: Float -> Int with -O2 panics ghc
----------------------+-----------------------------------------------------
 Reporter:  conal     |          Owner:             
     Type:  bug       |         Status:  new        
 Priority:  normal    |      Milestone:             
Component:  Compiler  |        Version:  6.8.1      
 Severity:  normal    |     Resolution:             
 Keywords:            |     Difficulty:  Easy (1 hr)
 Testcase:            |   Architecture:  Unknown    
       Os:  Unknown   |  
----------------------+-----------------------------------------------------
Changes (by int-e):

  * difficulty:  => Easy (1 hr)

Comment:

 The code contains an expression of the form {{{(comparison (conversion
 expr) int-literal)}}}. In {{{cmmMachOpFold}}}, the CMM optimizer tries to
 narrow the literal down to the type of expr, to see if it fits and the
 conversion can be eliminated. However this narrowing fails if {{{expr}}}
 has a floating point type. And that's good, because the optimization is
 not valid in that case.

 The patch changes {{{cmmMachOpFold}}} to not even attempt narrowing to
 floating point types.

 It fixes the example above.

 Affected architectures are x86 and x86_64 as it seems.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1916#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to