[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

elf-libg++ bug?

I posted this one to debian-user receiving no sensible response.
Did I omit required flags on the gcc-elf command? If this isn't the case
it's a bug in elf-libg++.

-- Siggy
------- start of forwarded message (RFC 934 encapsulation) -------

Here's a simple C++ program that segfaults unexpectedly. 
Maybe I overlooked some required flags (there is no g++-elf command). 

The following transcript hopefully contains all relevant information:

bora:~/tmp$ cat /proc/version
Linux version 1.2.13 (bsb@bora) (gcc version 2.6.3) #17 Thu Oct 19 07:25:57 MET 1995
bora:~/tmp$ cat segv.C
#include <fstream.h>
#include <String.h>

main(int, char *[])
  ifstream is("/proc/stats");

  while ( is ) {
    String head;
    is >> head;
    // ...
  return 0;
bora:~/tmp$ gcc-elf -v -lstdc++ -lg++ segv.C
Reading specs from /usr/lib/gcc-lib/i486-linuxelf/2.7.0/specs
gcc version 2.7.0
 /usr/lib/gcc-lib/i486-linuxelf/2.7.0/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=7 -D__ELF__ -Dunix -Di386 -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386) -D__i486__ segv.C /tmp/cca25281.ii
GNU CPP version 2.7.0 (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
End of search list.
 /usr/lib/gcc-lib/i486-linuxelf/2.7.0/cc1plus /tmp/cca25281.ii -quiet -dumpbase segv.cc -version -o /tmp/cca25281.s
GNU C++ version 2.7.0 (i386 Linux/ELF) compiled by GNU C version 2.7.0.
 /usr/i486-linuxelf/bin/as -V -Qy -o /tmp/cca252811.o /tmp/cca25281.s
GNU assembler version cygnus/linux-2.5.2l.15 (i486-linux), using BFD version cygnus/linux-2.5.2l.20
 /usr/i486-linuxelf/bin/ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.1 /usr/i486-linuxelf/lib/crt1.o /usr/i486-linuxelf/lib/crti.o /usr/i486-linuxelf/lib/crtbegin.o -L/usr/lib/gcc-lib/i486-linuxelf/2.7.0 -L/usr/i486-linuxelf/lib -lstdc++ -lg++ /tmp/cca252811.o -lgcc -lc -lgcc /usr/i486-linuxelf/lib/crtend.o /usr/i486-linuxelf/lib/crtn.o
bora:~/tmp$ ldd segv
	libstdc++.so.27 => /usr/i486-linuxelf/lib/libstdc++.so.27.0.2
	libg++.so.27 => /usr/i486-linuxelf/lib/libg++.so.27.0.2
	libc.so.5 => /usr/i486-linuxelf/lib/libc.so.5.2.7
	libm.so.5 => /usr/i486-linuxelf/lib/libm.so.5.0.3
bora:~/tmp$ segv
Segmentation fault

The program is valid C++, so what's going on here?

- -- Siggy (the middle S.)
------- end -------

Reply to: