From mboxrd@z Thu Jan 1 00:00:00 1970 From: pompl@ls11.cs.uni-dortmund.de To: gcc-gnats@gcc.gnu.org Subject: c++/2897: Segmentation fault by calling methods of ifstream Date: Tue, 22 May 2001 05:16:00 -0000 Message-id: <20010522120638.29418.qmail@sourceware.cygnus.com> X-SW-Source: 2001-05/msg00623.html List-Id: >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: