[Bug c++/19985] New: executables created with -fprofile-arcs -ftest-coverage segfault in gcov_exit ()
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
[Bug middle-end/19985] executables created with -fprofile-arcs -ftest-coverage segfault in gcov_exit ()
--- Additional Comments From lothar at xcerla dot com 2005-02-15 21:46 --- Created an attachment (id=8201) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8201&action=view) test case to reproduce the segfault This is a project of a small test case that reproduces the segmentation fault. It's build tool is SCons. If you don not want to use SCons, here's the command line(s) executed: /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 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19985
[Bug middle-end/19985] executables created with -fprofile-arcs -ftest-coverage segfault in gcov_exit ()
--- Additional Comments From lothar at xcerla dot com 2005-03-01 01:03 --- Changed severity to critical, as the compiler produces code that crashes when executing a coverage enabled executable. -- What|Removed |Added Severity|normal |critical http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19985
[Bug middle-end/19985] executables created with -fprofile-arcs -ftest-coverage segfault in gcov_exit ()
--- Additional Comments From lothar at xcerla dot com 2005-03-01 01:23 --- A bug that creates wrong code is critical for me. As our application depends on dynamically loading libraries, there's simply NO workaround for this bug. We can NOT execute any executables built with code coverage with either 3.4.1 or 4.0.0. I am really worried that 4.0.0 may get released without fully working code coverage. P.S. I tried to mark the bug as "waiting for feedback", but it said I do not have the permissions. Am I not the owner of the bug? If possible mark the bug as "waiting for feedback" and the Target Milestone to 4.0.0. Thanks -- What|Removed |Added Severity|normal |critical Keywords||wrong-code Known to fail||3.4.1 4.0.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19985
[Bug c++/17781] add STL error message filtering
--- Additional Comments From lothar at xcerla dot com 2004-10-01 21:57 --- STLfilt does a pretty good job already. It would be a GREAT use to the average gcc user if gcc only could mimic the behaviour of STLfilt. I consider myself quite fluent with STL/templates but even I have trouble to parse these long error messages. How much more trouble is it to a novice user. And even if the parsing fails in some situations; it's still worthwile in a lot other situations. In case it fails to parse the message or the user wants full control gcc could provide a switch to turn it off, so she can look (again) to the lengthy full error message. Its just that I'd like to have gcc do the message parsing than having another tool to wrap around gcc which may or may not work with different build environments. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17781
[Bug c++/17781] add STL error message filtering
--- Additional Comments From lothar at xcerla dot com 2004-10-02 00:58 --- Could you please state what "next C++" means (next standard, next version of gcc, ...). Actually I started this entry (with Severity: enhancement) to spawn a discussion about adding such aid to the compiler rather than to rely on external tools that may or may not work with the users build environment and may or may not break with new releases of the compiler. I believe that readable and understandsable compiler messages are CRUCIAL for both compiler writers and compiler users. If users do not understand error messages their cry for help will flood the compiler writers. I also would like to know what arguments speak against such a feature, as it proves to be worthwile (why should it be implemented as an external filter otherwise). As said before it could be controlled by a flag, so current message behaviour will be still available. If it is considered useful by enough people, why should it then not be included in the compiler? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17781