Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1590 Compiler bug in GCC 4.6.2

OTHER
pending
Cesar Strauss
Bug
none
Unknown
False
2013-02-08
2011-10-20
zhnmju123
No

Hi,

this one has cost me a good part of my sanity. After hours of painful trial and error I was able to create a minmal sample:

Symptoms: The compiled application crashes due to an allegedly uncaught exception. However the exception should be catched, as can be seen in the sourcecode.

Reproduce:
1. get MinGW latest repository catalogues (GCC 4.62) via automatic installer
2. Create a new CodeBlocks console project
3. Set optimization to O3 - this is important!
4. integrate file "main.cpp" from the attachment
Alternative: load test.cbp directly from attachment. However note that this is nothing more than steps 1 -4.

5. Compile, start and let it crash.

Further remarks:
This example is *really* minimal. If I make any change, the bug is not reproducible anymore, for example:
- Set optimization to O2 instead of O3 -> no crash
- Set size of char array "errorMessage" to 2000 instead of 20000 -> no crash
- use an older compiler from automatic installer: pre-packaged repository catalogues 20110802 -> no crash
- remove any of the other seemingly unused or superfluous pieced of code -> no crash
- This is not some theoretical problem, actually my users currently suffer from application crashes that can be attributed to this bug.

My Setup:
- Windows7 x64,
- latest repository catalogues (GCC 4.62) complete new install as of today, for the purpose of verification
- IDE: Codeblocks nighly

Regards, ZenJu

Discussion

  • zhnmju123
    zhnmju123
    2011-10-20

    Crash

     
    Attachments
  • zhnmju123
    zhnmju123
    2011-10-20

     
    Attachments
  • I assume you mean gcc 4.6.1? Or are you running mingw-w64's gcc 4.6.2? Regardless, try adding '-fno-omit-frame-pointer' to your compile options. I ran in to a similar issue with the O2 optimization when compiling the latest GDB.

     
  • zhnmju123
    zhnmju123
    2011-10-21

    > I assume you mean gcc 4.6.1
    Yes, it's 4.6.1-2

    > Or are you running mingw-w64's
    No, I'm using the ordinary 32-bit MinGW compiler.

    > try adding '-fno-omit-frame-pointer'
    Great, this works!!! Now I'm crossing fingers, this really worked around the problem and it doesn't pop up elsewhere...

     
  • xunxun
    xunxun
    2011-10-22

    As Kai said (http://gcc.gnu.org/ml/gcc/2011-10/msg00397.html), this is related with sjlj or dw2. And will mingw consider using sjlj?

     
  • ollydbg
    ollydbg
    2011-10-22

    I just test your example code using TDM GCC 4.6.1 sjlj version, it works quite well.

     
  • Earnie Boyd
    Earnie Boyd
    2011-10-22

    • assigned_to: nobody --> cstrauss
     
  • Earnie Boyd
    Earnie Boyd
    2011-10-22

    Assigning to Cesar since he is the maintainer of packages for MinGW.

     
  • Earnie Boyd
    Earnie Boyd
    2013-02-08

    • labels: MinGW --> gcc, dwarf2 vs sjlj, current?
    • status: open --> pending
    • milestone: --> OTHER
    • type: --> Bug
    • resolution: --> none
    • category: --> Unknown
    • patch_attached: --> False