[Issue 2053] New: PIC & ASM (EBX clobbering)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 28 06:52:43 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2053

           Summary: PIC & ASM (EBX clobbering)
           Product: DGCC aka GDC
           Version: unspecified
          Platform: Macintosh
        OS/Version: Mac OS X
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn at users.sf.net
        ReportedBy: fawzi at gmx.ch


I am no ams and PIC expert, but I think that the following code
{{{
                    volatile asm
                    {
                        push EDI;
                        lea EDI, newval;
                        mov ESI, [EDI];
                        mov ECX, 4[EDI];
                        lea EDI, equalTo;
                        mov EAX, [EDI];
                        mov EDX, 4[EDI];
                        mov EDI, val;
                        push EBX;
                        xchg EBX, ESI;
                        lock; // lock always needed to make this op atomic
                        cmpxch8b [EDI];
                        setz AL;
                        mov EBX, ESI;
                        pop EBX;
                        pop EDI;
                    }
}}}
should work on x86 when compiled with -fPIC, because EBX is pushed & popped and
no variable or symbol is accessed between push & pop.

The compiler complains about clobbered EBX (from the two xchg EBX and mov EBX
expressions).


-- 



More information about the D.gnu mailing list