Linux egcs g++ segfaults on fputs() & co
Leo Breebaart
leo@lspace.org
Thu Sep 18 04:25:00 GMT 1997
[ I have tried to see if this has come up before, but these lists have so
much traffic that the mailing list archives, without a proper search
function, are almost useless. My apologies if, like my previous bug-report,
this too is already known/solved. ]
Ever since the 970907 snapshot, I have had problems linking g++-compiled
programs that make use of C I/O functions.
For instance, the following program:
---------------------------------------------------------------------------
#include <cstdio>
main()
{
fputs("Hello World!\n", stderr);
}
---------------------------------------------------------------------------
will give a segmentation fault in something called _IO_stdout_ (), but only
if I compile it with g++, not with gcc.
Re-installing 970904 makes the problem go away upon re-linking, so my guess
is that *something* was changed in the g++-specific libraries between
970904 and 970707 that triggers this. Unfortunately the ChangeLog files do
not give me the necessary clue.
Does this problem sound familiar to anybody?
My g++ specs (running on a 2.0.29 Linux kernel):
---------------------------------------------------------------------------
[rama] % g++ -v hello.c -o hello
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.08/specs
gcc version egcs-2.90.08 970917 (gcc2-970802 experimental)
/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.08/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Di386 -Di586 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -D__i586__ -Asystem(unix) -Acpu(i386) -Amachine(i386) hello.c /tmp/cca10615.ii
GNU CPP version egcs-2.90.08 970917 (gcc2-970802 experimental) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/g++
/usr/local/include
/usr/local/i586-pc-linux-gnulibc1/include
/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.08/include
/usr/include
End of search list.
/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.08/cc1plus /tmp/cca10615.ii -quiet -dumpbase hello.cc -version -o /tmp/cca10615.s
GNU C++ version egcs-2.90.08 970917 (gcc2-970802 experimental) (i586-pc-linux-gnulibc1) compiled by GNU C version egcs-2.90.08 970917 (gcc2-970802 experimental).
as -V -Qy -o /tmp/cca106151.o /tmp/cca10615.s
GNU assembler version 970202 (i486-linux), using BFD version 2.7.0.9
/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.08/ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.1 -o hello /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.08/crtbegin.o -L. -L/usr/local/lib -L/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.08 -L/usr/local/i586-pc-linux-gnulibc1/lib -L/usr/local/lib /tmp/cca106151.o -lstdc++ -lm -lgcc -lc -lgcc /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.08/crtend.o /usr/lib/crtn.o
---------------------------------------------------------------------------
Many thanks in advance for any help and feedback,
--
Leo Breebaart <leo@lspace.org>
More information about the Gcc-bugs
mailing list