[GHC] #6156: Optimiser bug on linux-powerpc
GHC
cvs-ghc at haskell.org
Wed Aug 22 12:24:01 CEST 2012
#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):
Replying to [comment:39 simonmar]:
> > which is weird in that the FFI version is incorrect, but only when
optimisation is off.
>
> Did you mean to say ''on'' here?
Yes.
Simplifying the haskell code (adding unsafe as suggested):
{{{
import Foreign.C.Types
import Numeric
foreign import ccall unsafe "c_printInt64" printInt64 :: CLLong -> IO ()
main :: IO ()
main = printInt64 input
input :: CLLong
input = 0x1a2a3a4a5a6a7a8a
}}}
compiles to the following ASM:
{{{
Main.main1_info:
_c1ni:
lis 31, 0 ; r31 = 0
ori 31, 31, 31370 ; r31 |= 0x7a8a
lis 30, 0 ; r30 = 0
ori 31, 31, 0 ; r30 |= 0
mr 3, 30 ; r3 = r30
mr 4, 31 ; r4 = r31
bl c_printInt64
lis 14, GHC.Tuple.()_closure+1 at ha
addi 14, 14, GHC.Tuple.()_closure+1 at l
lwz 31, 0(22)
mtctr 31
bctr
}}}
Obviously the generated code is wrong. Looking at the PPC code generator
now.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:40>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list