Bug 2053 – PIC & ASM (EBX clobbering)

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
PowerPC
OS
Mac OS X
Creation time
2008-04-28T08:52:00Z
Last change time
2015-06-09T05:15:21Z
Keywords
rejects-valid
Assigned to
ibuclaw
Creator
fawzi

Comments

Comment #0 by fawzi — 2008-04-28T08:52:41Z
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).
Comment #1 by sean — 2008-04-28T11:40:09Z
Oh I see what you're saying. Thanks. I'll make this change.
Comment #2 by ibuclaw — 2012-07-06T05:23:02Z
D Inline Assembler support in GDC has been yanked out. So this report is no longer valid.