This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/2897: Segmentation fault by calling methods of ifstream



>Number:         2897
>Category:       c++
>Synopsis:       Segmentation fault by calling methods of ifstream
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 22 05:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Marc Pompl
>Release:        2.95.2
>Organization:
>Environment:
sparc-sun-solaris2.6  
>Description:
I have build a little program to so some wild stuff.
In this routine I am using ifstream, such as seekg()
and so on as given in several examples.
And on my Linux it works quite well, but on Solaris 2.6 
every call to such routines leads to a segmentation fault.

The ddd tells:

Program received signal SIGSEGV, Segmentation fault.
0xff2c5934 in _malloc_unlocked ()

and backtrace show me this:

...
in filebuf::seekoff () at fileops.c: 454
in _IO_doallocbuf () at genops.c: 322
in filebuf::doallocate () at filebuf.cc:151
in _IO_file_doallocate () at  filedoalloc.c: 102
in malloc ()
in _malloc_unlocked ()

Here follows he code snapshot:

  ifstream eingabe(dateiname);
  if (!eingabe) {
    cerr << "Datei '" << dateiname << "' konnte nicht geoeffnet werden!\n";cerr.flush();
    exit(5);
  }
  //cerr << "Position: " << eingabe.tellg() << "\n"; cerr.flush();
    // If you undocument the upper line you will get a segmentation fault!
  links = 0;
  eingabe.seekg(0,ios::end);
    // Here also!
 
Hope, you are able to fix this bug!
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]