problem with iostream

martin.berger@talk21.com martin.berger@talk21.com
Fri Mar 24 03:11:00 GMT 2000


hello, i have just upgraded to the latest version of redhat linux
and suddenly my g++ compiled programs fall over. the problem seems to
be related to the iostream library. here is an example program that
fails (the details of how cout is used dont seem to matter. the fault
seems to occur every time cout is used).

#include <iostream>

int main( int, char* )
{
      cout << "" << endl;
}

(below you'll find the relevant compiler and gdb output). alas, i'm not too
familiar with the g++ system and the redhat distribution. i suspect
that the problem is some trivial omission in my setup. but i can't work out
what. can you please help?

thanks, martin

~/c++/NEW> g++ -v test.cpp       
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix) -D__EXCEPTIONS -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di586 -Dpentium -D__i586 -D__i586__ -D__pentium -D__pentium__ test.cpp /tmp/cc5KSDQU.ii
GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++
 /usr/local/include
 /usr/local/i586-pc-linux-gnu/include
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/cc1plus /tmp/cc5KSDQU.ii -quiet -dumpbase test.cc -version -o /tmp/cc814umP.s
GNU C++ version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i586-pc-linux-gnu) compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
 as -V -Qy -o /tmp/ccKIZ6NC.o /tmp/cc814umP.s
GNU assembler version 2.9.1 (i386-redhat-linux), using BFD version 2.9.1.0.24
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/crtbegin.o -L/usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66 -L/usr/local/i586-pc-linux-gnu/lib -L/usr/local/lib /tmp/ccKIZ6NC.o -lstdc++ -lm -lgcc -lc -lgcc /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.91.66/crtend.o /usr/lib/crtn.o
~/c++/NEW> ./a.out 
Segmentation fault (core dumped)



gdb a.out core 
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
Core was generated by `./a.out'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
#0  0x4008b012 in __overflow (f=0x80539e0, ch=10) at genops.c:197
197     genops.c: No such file or directory.
(gdb) where
#0  0x4008b012 in __overflow (f=0x80539e0, ch=10) at genops.c:197
#1  0x40088191 in _IO_putc (c=10, fp=0x80539e0) at putc.c:33
#2  0x804c0eb in endl (outs=@0x8053ae0)
    at ../../../egcs-1.1.2/libio/streambuf.h:395
#3  0x804cbb0 in ostream::operator<< (this=0x8053ae0, 
    func=0x804c0d8 <endl(ostream &)>)
    at ../../../egcs-1.1.2/libio/iostream.h:106
#4  0x804a322 in main ()
#5  0x4004d1eb in __libc_start_main (main=0x804a300 <main>, argc=1, 
    argv=0xbffffc94, init=0x8049dc0 <_init>, fini=0x8052360 <_fini>, 
    rtld_fini=0x4000a610 <_dl_fini>, stack_end=0xbffffc8c)
    at ../sysdeps/generic/libc-start.c:90
(gdb) 




--------------------
talk21 your FREE portable and private address on the net at http://www.talk21.com



More information about the Gcc-help mailing list