This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/2907: libstdc++ compiled with optimization fails to initialize ios.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: Re: libstdc++/2907: libstdc++ compiled with optimization fails to initialize ios.
- From: Carlo Wood <carlo at alinoe dot com>
- Date: Wed, 23 May 2001 04:58:57 +0200
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <20010523001024.15267.qmail@sourceware.cygnus.com>
After compiling as above, and using the given test program that links
directly with the compiled (not installed) libstdc++:
~/c++/libcw/src/libcwd/testsuite>ldd a.out
librmalloc.so.1 => /home/carlo/c++/rmalloc/librmalloc.so.1 (0x40018000)
libstdc++.so.3 => /usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.3 (0x4001d000)
libm.so.6 => /lib/libm.so.6 (0x4015d000)
libgcc_s.so.0 => /usr/src/gcc/gcc-objdir-3.0/gcc/libgcc_s.so.0 (0x4017e000)
libc.so.6 => /lib/libc.so.6 (0x40188000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
in a different environment (not affecting the environment where I am compiling the
stdc++ library) (note that rmalloc is used to make sure there is no memory corruption
involved), I did the following tests:
/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src>grep '^CXXFLAGS =' Makefile
CXXFLAGS = -O9 -march=pentiumpro -fomit-frame-pointer -D_GNU_SOURCE
~/c++/libcw/src/libcwd/testsuite>a.out 2> /dev/null
Segmentation fault (core dumped)
/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src>vi Makefile
/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src>grep '^CXXFLAGS =' Makefile
CXXFLAGS = -O9 -D_GNU_SOURCE
/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src>rm *.lo *.o
/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src>make > /dev/null
~/c++/libcw/src/libcwd/testsuite>a.out 2> /dev/null
~/c++/libcw/src/libcwd/testsuite>
Conclusion: the problem is either -march=pentiumpro or -fomit-frame-pointer
And so on...
CXXFLAGS in src/Makefile result
-O9 -march=pentiumpro : no core
-fomit-frame-pointer : no core
-O9 -fomit-frame-pointer : core
-O2 -fomit-frame-pointer : core
-O -fomit-frame-pointer : core
-fomit-frame-pointer : no core
Next I started to compile the files one by one with -O -fomit-frame-pointer.
basic_file : no core
bitset : no core
c++locale : no core
codecvt : no core
complex_io : no core
functexcept : no core
globals : no core
ios : no core
limitsMEMBERS : no core
locale-inst : no core
locale : core
Next I compiled all files with -O -fomit-frame-pointer *except* locale.cc, this
gave no core. Finally I recompiled all files with -O9 -march=pentiumpro -fomit-frame-pointer
except locale.cc, which was compiled with nothing. This still resulted in no core.
Conclusion, the problem is compiling locale.cc with -O -fomit-frame-pointer.
Next I started to use different options instead of -O for locale.lo, the rest still
compiled with -O9 -march=pentiumpro -fomit-frame-pointer.
CXXFLAGS in src/Makefile result
: no core
-O -fomit-frame-pointer : core
-fthread-jumps -fdefer-pop -fomit-frame-pointer : core
-fomit-frame-pointer : no core
-fdefer-pop -fomit-frame-pointer : core
-fthread-jumps -fomit-frame-pointer : no core
Final conclusion: The problem shows itself when compiling locale.cc with
"-fdefer-pop -fomit-frame-pointer", or to be exact:
/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src>make
/bin/sh ../libtool --tag CXX --mode=compile /usr/src/gcc/gcc-objdir-3.0/gcc/xgcc \
-B/usr/src/gcc/gcc-objdir-3.0/gcc/ -nostdinc++ -L/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src \
-L/usr/src/gcc/gcc-objdir-3.0/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/local/gcc-3.0/i686-pc-linux-gnu/bin/ \
-B/usr/local/gcc-3.0/i686-pc-linux-gnu/lib/ -isystem /usr/local/gcc-3.0/i686-pc-linux-gnu/include -nostdinc++ \
-I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/std \
-I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/include/c_std -I../include \
-I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/libsupc++ -I../libio -I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/libio \
-I/usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/libmath \
-fthread-jumps -fomit-frame-pointer -D_GNU_SOURCE \
-fno-implicit-templates -Wall -Wno-format -W -Wwrite-strings -Winline -fdiagnostics-show-location=once \
-ffunction-sections -fdata-sections -g -c /usr/src/gcc/gcc-cvs-3.0/libstdc++-v3/src/locale.cc
--
Carlo Wood <carlo@alinoe.com>