Jeff Brown
2008-Apr-04 22:29 UTC
library bug in gcc43 port on fbsd7 -- aborts when throwing exception
I believe I've found a bug in the libgcc or libstdc++ library (not sure which one) packaged with the gcc43 port in fbsd7 on an Intel x86-64. A program linked against those libraries aborts when an exception is thrown. It does not abort if -lpthread is added to the link line, even though the program does not use threads. I believe the problem is related to the pthread stubs in libgcc, but I don't know enough to find the exact problem or fix it. An example is below. My system:>uname -aFreeBSD testlab5 7.0-STABLE FreeBSD 7.0-STABLE #1: Thu Feb 28 10:06:47 EST 2008 root@builder:/usr/obj/usr/sources/FreeBSD.7/src/sys/GENERIC amd64>which g++43/usr/local/bin/g++43>g++43 --versiong++43 (GCC) 4.3.1 20080313 (prerelease) etc.>echo $LD_LIBRARY_PATH/usr/local/lib/gcc-4.3.1 Sample program. When compiled with "g++43 test.cc" , it aborts upon the throw. When compiled with "g++43 test.cc -lpthread", it runs correctly. #include <stdio.h> int main(int argc, char* argv[]) { try { throw 1; } catch (...) { printf("Caught exception\n"); } } Again, it only aborts when omitting -lpthread AND using the dynamic libs in /usr/local/lib/gcc-4.3.1. If I unsetenv LD_LIBRARY_PATH, libraries are loaded from the base fbsd7 installation in /usr/lib, which works. Thanks.