#4867: ghci displays negative floats incorrectly (was: Incorrect result from trig functions) -------------------------------+-------------------------------------------- Reporter: gwright | Owner: gwright Type: bug | Status: new Priority: high | Milestone: 7.0.2 Component: GHCi | Version: 7.0.1 Keywords: | Testcase: Blockedby: | Difficulty: Os: MacOS X | Blocking: Architecture: x86_64 (amd64) | Failure: Incorrect result at runtime -------------------------------+--------------------------------------------
Comment(by gwright): Something strange is still going on. With the test program {{{ gwright-macbook> cat foo.hs -- -- Test returning -1.0 -- module Main where main = print (-1.0 :: Double) }}} on HEAD I get {{{ gwright-macbook> inplace/bin/ghc-stage2 --interactive foo.hs GHCi, version 7.1.20110210: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. *Main> main --1.0 *Main> }}} Compiling the same program gives {{{ gwright-macbook> inplace/bin/ghc-stage2 --make foo.hs [1 of 1] Compiling Main ( foo.hs, foo.o ) Linking foo ... ld: warning: -read_only_relocs cannot be used with x86_64 gwright-macbook> ./foo -1.0 gwright-macbook> }}} So this appears to be a `ghci` or linker bug still. Slightly more distressing is when I tried the above test program on the ghc-7.0 tree that I did most of my debugging work on: {{{ gwright-macbook> inplace/bin/ghc-stage2 --interactive foo.hs GHCi, version 7.0.1.20101221: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Ok, modules loaded: Main. Prelude Main> main --0.0 Prelude Main> }}} in this case the answer is entirely wrong. I went back to `gdb` and stepped through my original test program until I reached the location where `%xmm7` is loaded. The memory contents pointed to by `%rip` plus the offset seem to contain the correct mask, but I will check again. I suspect an off by one or size of the relocated object issue. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4867#comment:33> 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