I'm not sure whether is a bug in gcc/libstdc++ or in my program, and I
can't reproduce it in a small test case, so I'm asking for help rather
than filing a bug report.
I have a good sized program with lots of C, lots of C++, stl and
boost_serialization. It shows signs of life (but is still under heavy
development) using gcc-4.0.0 as distributed with Fedora Core 4. My
problem is that when I yum-updated to gcc (GCC) 4.0.1 20050727 (Red Hat
4.0.1-5) it seg faults in exit every time.
uname -a
Linux bill 2.6.12-1.1398_FC4 #1 Fri Jul 15 00:52:32 EDT 2005 i686 i686
i386 GNU/Linux
Program terminated with signal 11, Segmentation fault.
#0 0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x083738f9 in __tcf_0 ()
#2 0x083ec186 in exit ()
#3 0x08166bcd in MyCodeMain (argc=2, argv=0x9cf24d8,
username=0x9cf34f0 "wfmann") at something.c:2261
#4 0x0804858c in main (argc=2, argv=0x9cf24d8) at main.c:334
The program is statically linked, including the dlopen logic which I
don't believe is being called. I don't know of any static class usage
in our code, but can't tell about stl or boost.
I'm assuming that this is related to the (mis?)use of atexit for static
destructors. We tried the -fuse-cxa-atexit option with no apparent change.
The problem disappears when I substitute the 4.0.0 version of
libstdc++.a for the 4.0.1 version in /usr/lib/gcc/i386-redhat-linux/4.0.1/
I know this is awful but it's working for me temporarily!
Even if this isn't a gcc/libstdc++ bug, it would be nice to have the
library do something more helpful than this seg fault.
What should I do next? I could compile a debugging version of libstdc++
and poke around with gdb, but I'd appreciate some guidance, please.
--
Bill Mann -- Sudbury, MA -- 978-443-5671 -- cell: 978-460-3287