mingw compile issues

Lucas Fisher lucas.fisher at gmail.com
Mon Nov 7 21:28:52 EST 2011

I'm compiling im.pidgin head on Windows roughly following
http://developer.pidgin.im/ticket/14678.  I was able to get this
compiling and sort out all the dependencies.  However, I found that
Pidgin would crash when you quit.  I traced this to WinMain in
pidgin/win32/winpidgin.c. It crashes because when WinMain returns the
stack pointer is not pointing to the return address, but other data on
the stack. It almost looks like the compiler is messing up and
generating the wrong instructions. When I turn off optimizations this
problem goes away.

Has anyone else seen this behavior?


Relevant code:
mov     [esp+0CACh+var_CAC], edi
call    LocalFree
push    ecx
mov     [esp+0CACh+var_CA4], ebp
mov     [esp+0CACh+var_CA8], esi
mov     eax, [esp+0CACh+hInstance]
mov     [esp+0CACh+var_CAC], eax
call    ds:dword_408024   # is the calling convention correct here?
sub     esp, 0Ch            # this instruction misaligns the stack pointer
add     esp, 0CACh
pop     ebx
pop     esi
pop     edi
pop     ebp
retn    10h

More information about the Devel mailing list