id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
1910,Native Code gen miscompiles double2Int# / float2Int# on x86_32,int-e,igloo,"''Brad Clow'':
I upgraded from GHC 6.6.1 to 6.8.1 and around that time I noticed that
the output from an app I am working on changed. I have distilled the
code down to the following example that produces different output
depending on whether it is compiled with -O2 or not:

{{{
main = do
    let (T x) = read ""T 3""
    print $ f x
    print $ g x

data T = T Int deriving (Read, Show)

f x = truncate $ 2000 / fromIntegral ((x * 25) + 10)

g :: Int -> Int
g x = f x
}}}
(See http://www.haskell.org/pipermail/haskell-cafe/2007-November/034930.html)

The reason is that the code generated for {{{double2Int#}}} by the native code generator does not round correctly. (It's not 100% predictable, I believe, but it'll usually round.)",bug,closed,normal,6.8.2,Compiler (NCG),6.8.1,fixed,,,Unknown/Multiple,x86,,Easy (less than 1 hour),,,,
