This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/2897: Segmentation fault by calling methods of ifstream
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/2897: Segmentation fault by calling methods of ifstream
- From: pompl at ls11 dot cs dot uni-dortmund dot de
- Date: 22 May 2001 12:06:38 -0000
- Reply-To: pompl at ls11 dot cs dot uni-dortmund dot de
>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: