I created a small test I will attach to this bug report that shows that executables created with -fprofile-arcs -ftest-coverage crash in gcov_exit () if they dynamically load functions from libraries. I tested with gcc 3.4.1 and 4.0-20050213. Both show the same problem. Here's the gdb stack trace for both compilers: Program terminated with signal 11, Segmentation fault. #0 gcov_exit () at ../../gcc-3.4.1/gcc/libgcov.c:139 139 if (!((1 << t_ix) & gi_ptr->ctr_mask)) (gdb) where #0 gcov_exit () at ../../gcc-3.4.1/gcc/libgcov.c:139 #1 0x4018b820 in exit () from /lib/tls/libc.so.6 #2 0x40176b1a in __libc_start_main () from /lib/tls/libc.so.6 #3 0x080491b1 in _start () at ../sysdeps/i386/elf/start.S:119 Program terminated with signal 11, Segmentation fault. #0 gcov_exit () at ../../gcc-4.0-20050213/gcc/libgcov.c:139 139 if (!((1 << t_ix) & gi_ptr->ctr_mask)) ((gdb) where #0 gcov_exit () at ../../gcc-4.0-20050213/gcc/libgcov.c:139 #1 0x4018b820 in exit () from /lib/tls/libc.so.6 #2 0x40176b1a in __libc_start_main () from /lib/tls/libc.so.6 #3 0x08049031 in _start () at ../sysdeps/i386/elf/start.S:119 The test uses SCons as a build tool. But I give the build arguments here for the 3.4.1 compiler: /opt2/GNU/bin/g++-3.4.1 -O0 -g -D_REENTRANT -W -Wall -Wpointer-arith -Wno-uninitialized -Woverloaded-virtual -Wcast-align -Wwrite-strings -Wcomments -march=pentiumpro -DCOVERAGE -fprofile-arcs -ftest-coverage -Isrc -c -o src/prog/.build/posix/coverage/main.o src/prog/main.cpp /opt2/GNU/bin/g++-3.4.1 -g -Wl,-E -o bin/posix/coverage/prog src/prog/.build/posix/coverage/main.o -Llib/posix/coverage -lstdc++ -lpthread -lrt -ldl -lgcov /opt2/GNU/bin/g++-3.4.1 -O0 -g -D_REENTRANT -W -Wall -Wpointer-arith -Wno-uninitialized -Woverloaded-virtual -Wcast-align -Wwrite-strings -Wcomments -march=pentiumpro -DCOVERAGE -fprofile-arcs -ftest-coverage -fPIC -Isrc -c -o src/calc/.build/posix/coverage/calc.os src/calc/calc.cpp /opt2/GNU/bin/g++-3.4.1 -g -Wl,-E -Wl,-soname=libcalc.so.1.0 -shared -o lib/posix/coverage/libcalc.so src/calc/.build/posix/coverage/calc.os -Llib/posix/coverage -lstdc++ -lpthread -lrt -ldl -lgcov Lothar
-- Summary: executables created with -fprofile-arcs -ftest-coverage segfault in gcov_exit () Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lothar at xcerla dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19985