mingw compile issues

Daniel Atallah daniel.atallah at gmail.com
Wed Nov 9 23:20:47 EST 2011


On Wed, Nov 9, 2011 at 20:42, Lucas Fisher <lucas.fisher at gmail.com> wrote:
> Yeah, I'm using mingw-gcc 4.6.1.  Looking around online it looks like
> others are having this issue with -O2 which is used by Pidgin's win32
> build. I modified CFLAGS in libpurple/win32/global.mak to use -O0
> instead and no more crashes.
>
> Also, when compiling with mingw-gcc -O2 exchndl.dll causes a crash on
> startup. If I get remove exchndl.dll it doesn't crash on startup. That
> crash also goes away with -O0.

Looks like you've got a better idea of what's going on than I do.  I
haven't seen this reported on the mingw mailing list, so it might be a
good idea to do so.

-D

>
> Lucas
>
> On Wed, Nov 9, 2011 at 7:15 PM, Daniel Atallah <daniel.atallah at gmail.com> wrote:
>> On Mon, Nov 7, 2011 at 21:28, Lucas Fisher <lucas.fisher at gmail.com> wrote:
>>> 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?
>>>
>>> Lucas
>>>
>>> Relevant code:
>>> loc_40213A:
>>> 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
>>
>> Which version of gcc are you using to build?
>>
>> I've seen some weirdness with optimizations in mingw gcc 4.6.
>>
>> -D
>>
>




More information about the Devel mailing list