library bug in gcc43 port on fbsd7 -- aborts when throwing exception

Jeff Brown jsbrown at
Fri Apr 4 22:29:38 UTC 2008

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 -a
FreeBSD testlab5 7.0-STABLE FreeBSD 7.0-STABLE #1: Thu Feb 28 10:06:47 EST
2008  root at builder:/usr/obj/usr/sources/FreeBSD.7/src/sys/GENERIC amd64
>which g++43
>g++43 --version
g++43 (GCC) 4.3.1 20080313 (prerelease)

Sample program.
When compiled with "g++43" , it aborts upon the throw.
When compiled with "g++43 -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.


More information about the freebsd-stable mailing list