#3561: Incorrect code generation on x86
-----------------------------+----------------------------------------------
Reporter:  aleksey           |          Owner:          
    Type:  bug               |         Status:  new     
Priority:  normal            |      Component:  Compiler
 Version:  6.10.4            |       Severity:  major   
Keywords:                    |       Testcase:          
      Os:  Unknown/Multiple  |   Architecture:  x86     
-----------------------------+----------------------------------------------
 This program prints "0" on x86 with ghc-6.10.4 and "-O" optimization at
 least under Linux and FreeBSD:
 {{{
 main = print $ pqr' 0 1

 pqr' :: Int -> Int -> Integer
 pqr' a b | a == b - 1 = rab
          | otherwise = ram * rmb
     where m = (a + b) `div` 2
           ram = pqr' a m
           rmb = pqr' m b
           rab = toInteger (6 * b - 5) * toInteger (2 * b - 1) *
                 toInteger (6 * b - 1)
 }}}
 It prints the correct value "5" with either "-O0", or "-fvia-C", or on
 x86_64.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3561>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to