On x86-linux, with the latest HEAD, the following code triggers a register allocation bug:

#include "Cmm.h"
foo {
        I32 bar;                                // bar get's assigned to %eax
        foreign "C" bar ();   // %eax is correctly saved accross this call
        foreign "C" bar ();   // But this call clobbers it.
        jump bar;                               // here we'll probably crash.
}

This gets compiled to:

.text
        .align 4,0x90
.globl foo
foo:
        movl %esi,%eax
        movl %eax,64(%esp)
        call *%eax
        addl $0,%esp
        movl 64(%esp),%eax
        call *%eax
        addl $0,%esp
        jmp *%eax

As you can see, %eax isn't restored between the second call and the jump.
This bug prevents me from finding any further problems with the PIC support I
just comitted :-).


Cheers,

Wolfgang

_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to