#6156: Optimiser bug on linux-powerpc ------------------------------------------+--------------------------------- Reporter: erikd | Owner: igloo Type: bug | Status: new Priority: normal | Milestone: 7.6.1 Component: Compiler | Version: 7.4.1 Resolution: | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------------------+---------------------------------
Comment(by erikd): Digging deeper: {{{ {-# LANGUAGE MagicHash #-} import GHC.Int import GHC.Word import GHC.IntWord64 import Numeric (showHex) main :: IO () main = putStrLn (showHex (wordToInt64 input) "") input :: Word64 input = 0x1a2a3a4a5a6a7a8a wordToInt64 :: Word64 -> Int64 wordToInt64 (W64# x) = I64# (word64ToInt64# x) }}} also gives an incorrect result when optimisation is on. The `word64ToInt64#` is foreign imported as: {{{ foreign import ccall unsafe "hs_word64ToInt64" word64ToInt64# :: Word64# -> Int64# }}} and `hs_word64ToInt64` is defined in C as : {{{ HsInt64 hs_word64ToInt64 (HsWord64 w) {return (HsInt64) w;} }}} and testing that function in isolation in a small C program shows no problem. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:35> 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