#2016: GHC generates bad code for pointer manipulations from .cmm
-------------------------------+--------------------------------------------
Reporter: wb.kloke | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.8.2
Severity: major | Keywords:
Difficulty: Unknown | Testcase:
Architecture: x86_64 (amd64) | Os: FreeBSD
-------------------------------+--------------------------------------------
In files rts/StgStdThunks.cmm (and rts/StgMiscClosures.cmm also) a
natively booted x86_64 compiler generates the following wrong assembler
output:
{{{
.text
.align 8
.quad 0
.quad 34
.globl stg_sel_ret_0_upd_info
stg_sel_ret_0_upd_info:
movl $4294967288,%eax
movq %rbx,%rcx
andq %rax,%rcx
movq 8(%rcx),%rbx
addq $8,%rbp
...
}}}
The correct code for the movl line is
{{{
movq $-8,%rax
}}}
The real output from a correct compiler (such as the stage1 compiler
crosscompiled from i386) is slightly different due to optimisation, but
equivalent to my correction.
I checked this bug with different compilation flags in the stage1 and
stage2 creation phase (with -fasm or -fvia-C). I am not sure whether the
bug is present in other x86_64 OSs, which are supported for longer than
FreeBSD. But it is easy to check. Just compile the file with -S with a
stage2 compiler.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2016>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs