Skip to content

Bad FP code generated by x86_64 native code generator.

With this module:

main :: IO ()
main = mapM_ print $ map log2 vals

log2 :: Int -> Double
log2 x = logBase 2 (fromIntegral x)

vals :: [Int]
vals = [1, 2, 17]

on amd64/Linux with the HEAD, I'm seeing:

$ ghc -fforce-recomp -O -fregs-graph -o num012 num012.hs; ./num012
0.0
1.2607434391239006e13
5.153241959769104e13

Ben, are you able to take a look please?

Trac metadata
Trac field Value
Version 6.11
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (NCG)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture Unknown/Multiple
Edited by benl
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information