Ticket #3561 (closed bug: fixed)
Incorrect code generation on x86
| Reported by: | aleksey | Owned by: | simonmar |
|---|---|---|---|
| Priority: | high | Milestone: | 6.12.1 |
| Component: | Compiler | Version: | 6.10.4 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | x86 |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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.
Change History
Note: See
TracTickets for help on using
tickets.
