HJ's patch to libio works on Red Hat 4.2/libc 5.3.12

Mumit Khan khan@xraylith.wisc.edu
Sat Oct 11 18:35:00 GMT 1997


Joe Buck <jbuck@synopsys.com> writes:
> I installed HJ's patch, as modified according to Ulrich's suggestion,
> and all libio tests pass on a straight Red Hat 4.2 system.

Same here.

I seem to have an additional problem however. The attched stripped
down code core dumps on a i386-linux-gnulibc1 box with libc 5.3.12 
(RH 4.2). I've also attched the backtrace from gdb.

I've applied Jason's and HLJ's patches to date to egcs-971008.

To run it, create a text file "data.in" with a floating point number in
it.

=====
#include <fstream.h>
#include <cstdlib>

int main () {
  ifstream ifp ("data.in");
  if (!ifp) {
    cerr << "Error opening input \"data.in\"" << endl;
    exit (1);
  }

  double dummy;
  ifp >> dummy;			// <<<<<<< CORE DUMPS HERE
  if (!ifp) {
    cerr << "Error reading input \"data.in\"" << endl;
    exit (1);
  }

  exit (1);
}
=====

Here's the back trace:

% c++  -g -o ifstream ifstream.cc
% gdb ifstream
GDB is free software and you are welcome to 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.
GDB 4.16 (i586-unknown-linux), Copyright 1996 Free Software Foundation,
Inc...
(gdb) r
Starting program: /tmp/ifstream 
warning: Unable to find dynamic linker breakpoint function.
warning: GDB will be unable to debug shared library initializers
warning: and track explicitly loaded dynamic code.

Program received signal SIGSEGV, Segmentation fault.
0x4002dc12 in ostream::flush (this=0x40030bfc)
    at ../../../libio/iostream.cc:854
854         if (_strbuf->sync())
(gdb) bt
#0  0x4002dc12 in ostream::flush (this=0x40030bfc)
    at ../../../libio/iostream.cc:854
#1  0x4002ccd3 in istream::operator>> (this=0xbffffa28, x=@0xbffff9cc)
    at ../../../libio/iostream.h:159
#2  0x8048ae0 in main () at ifstream.cc:12
#3  0x80489db in ___crt_dummy__ ()
#4  0x4002b2f8 in __tf8ifstream () at ../../../libio/fstream.h:61
Cannot access memory at address 0xffa0.
(gdb) 




More information about the Gcc mailing list