A 64 bit build of gcc 4.4.2 installed via darwinports on a Mac Pro server
running Snow Leopard 10.6.2 causes a crash in the following program:
>cat src/test.cpp
#include <iostream>
struct X
{
~X () // crash disappears if there is no destructor
{
}
};
void
dummy ()
{
X x;
throw 0;
}
int main()
{
try
{
dummy ();
}
catch (...)
{
std::cout << "CAUGHT" << std::endl;
}
return 0;
}
Instead of the expected "CAUGHT" the system pops up with:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
abort() called
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libSystem.B.dylib 0x00007fff801a3fe6 __kill + 10
1 libSystem.B.dylib 0x00007fff80244e32 abort + 83
2 libgcc_s.1.dylib 0x00000001001a2aa2 uw_init_context_1 +
146
3 libgcc_s.1.dylib 0x00000001001a2ef8 _Unwind_Resume + 72
4 crash 0x0000000100000cfe main + 0
5 crash 0x0000000100000d0a main + 12
6 crash 0x0000000100000c88 start + 52
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x00007fff5fbff560 rcx: 0x00007fff5fbff288
rdx: 0x0000000000000000
rdi: 0x0000000000014c96 rsi: 0x0000000000000006 rbp: 0x00007fff5fbff2a0
rsp: 0x00007fff5fbff288
r8: 0x00000001002fc0a0 r9: 0x00000001002fc0a4 r10: 0x00007fff801a0026
r11: 0x0000000000000206
r12: 0x00007fff5fbff6a0 r13: 0x0000000100000cfe r14: 0x00007fff5fbff2b0
r15: 0x0000000000000000
rip: 0x00007fff801a3fe6 rfl: 0x0000000000000206 cr2: 0x00000001001a5924
Binary Images:
0x100000000 - 0x100000ff7 +crash ??? (???)
<1795FC81-D57C-8C65-42CB-984BCE974933> /Users/vlad/PRJ/test/crash
0x100003000 - 0x1000a9fe7 +libstdc++.6.dylib ??? (???)
<7ED4A235-4CEF-A737-9698-18B1301A9979> /sw/lib/gcc4.4/lib/libstdc++.6.dylib
0x100195000 - 0x1001a8ff7 +libgcc_s.1.dylib ??? (???)
<A31CA578-6BE8-891F-8F79-680CAAA8DE22> /sw/lib/gcc4.4/lib/libgcc_s.1.dylib
0x7fff5fc00000 - 0x7fff5fc3bdef dyld 132.1 (???)
<B633F790-4DDB-53CD-7ACF-2A3682BCEA9F> /usr/lib/dyld
0x7fff80155000 - 0x7fff80313ff7 libSystem.B.dylib ??? (???)
<526DD3E5-2A8B-4512-ED97-01B832369959> /usr/lib/libSystem.B.dylib
0x7fff8373b000 - 0x7fff8373fff7 libmathCommon.A.dylib ??? (???)
<95718673-FEEE-B6ED-B127-BCDBDB60D4E5> /usr/lib/system/libmathCommon.A.dylib
0x7fffffe00000 - 0x7fffffe01fff libSystem.B.dylib ??? (???)
<526DD3E5-2A8B-4512-ED97-01B832369959> /usr/lib/libSystem.B.dylib
Model: MacPro4,1, BootROM MP41.0081.B04, 8 processors, Quad-Core Intel Xeon,
2.66 GHz, 16 GB, SMC 1.39f5
As long as a local object 'x' with a destructor is created prior to the 'throw'
inside dummy(), the problem occurs.
[18:53:02] test>g++-4 -v -save-temps src/test.cpp -o crash
Using built-in specs.
Target: x86_64-apple-darwin10
Configured with: ../gcc-4.4.2/configure --prefix=/sw --prefix=/sw/lib/gcc4.4
--mandir=/sw/share/man --infodir=/sw/share/info
--enable-languages=c,c++,fortran,objc,java --with-gmp=/sw
--with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-system-zlib
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
--disable-libjava-multilib --build=x86_64-apple-darwin10
--host=x86_64-apple-darwin10 --target=x86_64-apple-darwin10
Thread model: posix
gcc version 4.4.2 (GCC)
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.6.2' '-v' '-save-temps' '-o'
'crash' '-shared-libgcc' '-mtune=generic'
/sw/lib/gcc4.4/libexec/gcc/x86_64-apple-darwin10/4.4.2/cc1plus -E -quiet -v
-D__DYNAMIC__ src/test.cpp -fPIC -mmacosx-version-min=10.6.2 -mtune=generic
-fpch-preprocess -o test.ii
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/4.4.2/../../../../x86_64-apple-darwin10/include"
#include "..." search starts here:
#include <...> search starts here:
/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/4.4.2/../../../../include/c++/4.4.2
/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/4.4.2/../../../../include/c++/4.4.2/x86_64-apple-darwin10
/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/4.4.2/../../../../include/c++/4.4.2/backward
/sw/lib/gcc4.4/include
/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/4.4.2/include
/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/4.4.2/include-fixed
/usr/include
/System/Library/Frameworks
/Library/Frameworks
End of search list.
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.6.2' '-v' '-save-temps' '-o'
'crash' '-shared-libgcc' '-mtune=generic'
/sw/lib/gcc4.4/libexec/gcc/x86_64-apple-darwin10/4.4.2/cc1plus -fpreprocessed
test.ii -fPIC -quiet -dumpbase test.cpp -mmacosx-version-min=10.6.2
-mtune=generic -auxbase test -version -o test.s
GNU C++ (GCC) version 4.4.2 (x86_64-apple-darwin10)
compiled by GNU C version 4.4.2, GMP version 4.3.1, MPFR version 2.4.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: e5506cfd76732233066589d06543f3ba
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.6.2' '-v' '-save-temps' '-o'
'crash' '-shared-libgcc' '-mtune=generic'
as -arch x86_64 -force_cpusubtype_ALL -o test.o test.s
COMPILER_PATH=/sw/lib/gcc4.4/libexec/gcc/x86_64-apple-darwin10/4.4.2/:/sw/lib/gcc4.4/libexec/gcc/x86_64-apple-darwin10/4.4.2/:/sw/lib/gcc4.4/libexec/gcc/x86_64-apple-darwin10/:/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/4.4.2/:/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/
LIBRARY_PATH=/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/4.4.2/:/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/4.4.2/../../../:/usr/lib/
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.6.2' '-v' '-save-temps' '-o'
'crash' '-shared-libgcc' '-mtune=generic'
/sw/lib/gcc4.4/libexec/gcc/x86_64-apple-darwin10/4.4.2/collect2 -dynamic -arch
x86_64 -macosx_version_min 10.6.2 -weak_reference_mismatches non-weak -o crash
-lcrt1.10.5.o -L/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/4.4.2
-L/sw/lib/gcc4.4/lib/gcc/x86_64-apple-darwin10/4.4.2/../../.. test.o -lstdc++
-lgcc_s.10.5 -lgcc -lSystem
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.6.2' '-v' '-save-temps' '-o'
'crash' '-shared-libgcc' '-mtune=generic'
>./crash
--
Summary: app compiled with 4.4.2 SIGABRTs after a trivial nested
throw/stack unwinding
Product: gcc
Version: 4.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vlad at demoninsight dot com
GCC build triplet: x86_64-apple-darwin10
GCC host triplet: x86_64-apple-darwin10
GCC target triplet: x86_64-apple-darwin10
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42159