#1603: a miscompilation of (`rem` 0x40000000)::Int with -O -fvia-C
---------------------------+------------------------------------------------
Reporter: Isaac Dupree | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.6.1
Severity: normal | Keywords:
Difficulty: Unknown | Os: Linux
Testcase: | Architecture: x86
---------------------------+------------------------------------------------
eival has the wrong value in this fairly minimal testcase:
{{{
module Eival(eival) where
eival :: [Int]
eival = syn
[-727299164,-506030719,-906763000,-1356112363,-1183678614,-970206674,-56]
syn :: [Int] -> [Int]
syn (d:ds) = case rem d 0x40000000 of
synD -> ((:) {-$!-} synD) {-$!-} (syn ds) --strictness/($!)s entirely
optional
syn [] = []
}}}
expected (and gotten with -O0 or -fasm (or hugs :)):
[-727299164,-506030719,-906763000,-282370539,-109936790,-970206674,-56]
buggy value:
[346442660,567711105,166978824,791371285,963805034,103535150,1073741768]
If the denominator is 0x40000001 or 0x3fffffff, the bug does not occur.
Verified in 6.6.1 and 6.7 on x86-32 Linux.
Only is buggy with both -O and -fvia-C. Adding -optc-O0 or -optc-O3
doesn't change the results.
{{{
]gcc --version
gcc (GCC) 4.1.2
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1603>
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