[Issue 5591] EBX register not preserved when calling stdcall function pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 16 12:13:14 PST 2011


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


hypothermia.frost at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |critical


--- Comment #2 from hypothermia.frost at gmail.com 2011-02-16 12:10:39 PST ---
After disassembly I found out that this code was generated(no -O switch):
//asm { mov EBX,3; } bar(4);
mov     ebx, 3
push    4
mov     ebx, large fs:2Ch
mov     esi, [ebx]
call    dword ptr [esi+4F4h]
mov     [ebp+var_20], ebx

//the next round ecx is used...
//asm { mov EBX,5; } bar(6);
mov     ebx, 5
push    6
mov     ecx, large fs:2Ch
mov     edx, [ecx]
call    dword ptr [edx+4F4h]
mov     [ebp+var_20], ebx

Why is DMD not preserving the EBX register in the first call? The worst thing
is that the compiler doesn't even know tha there's something in EBX... This
problem happened to me with when EBX had a this pointer and then DMD didn't
save it and after the function pointer call I got an exception!

I think this is a serious issue and should be looked at ASAP.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list