The test program below segfaults during __cxa_throw if -O2 is used. The problem is possibly related to generation of unwinding-information in conjunction with -freorder-blocks optimization. Testcase: $ uname -srvmo CYGWIN_NT-6.1 1.7.18(0.263/5/3) 2013-03-26 14:56 x86_64 Cygwin $ g++ --version g++ (GCC) 4.8.0 $ cat throw.cc #include <string> static int main_worker(int argc) { std::string s[32]; if (argc < 2) throw 42; return argc; } int main(int argc, char **argv) { try { return main_worker(argc); } catch (int i) { return i; } } $ g++ -O1 -o throw throw.cc $ ./throw; echo $? 42 $ g++ -O2 -o throw throw.cc $ ./throw; echo $? Segmentation fault 139 $ g++ -O2 -fno-reorder-blocks -o throw throw.cc $ ./throw; echo $? 42 $ g++ -O1 -freorder-blocks -g -o throw throw.cc $ ./throw; echo $? Segmentation fault 139 $ gdb throw ... (gdb) r Starting program: /tmp/throw/throw [New Thread 4164.0xe58] [New Thread 4164.0x7e8] gdb: unknown target exception 0x20474343 at 0x7fefd7c9e5d Program received signal ?, Unknown signal. 0x000007fefd7c9e5d in RaiseException () from /cygdrive/c/Windows/system32/KERNELBASE.dll
Dup of bug 56742. *** This bug has been marked as a duplicate of bug 56742 ***