#5165: GHC doesn't optimize FP excess precision properly -----------------------+---------------------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.1 | Keywords: Testcase: | Blockedby: Os: Linux | Blocking: Architecture: x86 | Failure: Incorrect result at runtime -----------------------+---------------------------------------------------- jmcarthur helped in constructing the test case. Consider the following program:
{{{ module Main where {-# NOINLINE x #-} {-# NOINLINE y #-} x, y :: Double x = 3 y = 7 main = print $ x/y == (3/7 :: Double) }}} When run on 32-bit Linux, we get the following results: {{{ ezyang@javelin:~$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.0.3 ezyang@javelin:~$ ghc --make Bar.hs -o Bar -O0 -fforce-recomp && ./Bar [1 of 1] Compiling Main ( Bar.hs, Bar.o ) Linking Bar ... True ezyang@javelin:~$ ghc --make Bar.hs -o Bar -O -fforce-recomp && ./Bar [1 of 1] Compiling Main ( Bar.hs, Bar.o ) Linking Bar ... False }}} The second result should be True (and only false if `-fexcess-precision` is specified). I also tested on a devel2 build of GHC HEAD and got similar results. This appears to be a regression from 6.12.1: {{{ ezyang@javelin:~$ /usr/bin/ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.1 ezyang@javelin:~$ /usr/bin/ghc --make Bar.hs -o Bar -O && ./Bar True }}} I also kind of suspect `-fexcess-precision` doesn't do anything for the native codegen (based on source code surfing), but it's hard to tell with this current bug. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5165> 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