This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[BUG] GCC 3.0.1 fstream problems
- To: gcc-bugs at gcc dot gnu dot org@abqn42.abq.sc.philips.com, libstdc++ at gcc dot gnu dot org@abqn42.abq.sc.philips.com
- Subject: [BUG] GCC 3.0.1 fstream problems
- From: Josh Martin <Josh dot Martin at abq dot sc dot philips dot com>
- Date: Thu, 6 Sep 2001 13:54:15 -0600 (MDT)
- Reply-To: Josh Martin <Josh dot Martin at abq dot sc dot philips dot com>
There seems to be a problem with the ifstream object that started with gcc 3.0.
If you open an ifstream, read in part of a file, close the stream, and then
re-open the stream for the same or a different file, the file position
(ifstream::tellg()) and the eof flag (ifstream::eof()) are correctly reset.
However, if, during the opening and reading in of the file, you encounter an
EOF, the file position and eof flag and not reset upon the close() and
subsequent open(). A call to ifstream::clear() in the stream is required to get
the stream to reset.
A simple test case is given with important information output via cout at
critical moments.
- Josh
The compile command line and output are as follows, and the preprocessed file
(test.ii) is attached.
---
g++ -v -save-temps -Wall -Wl,+vallcompatwarnings -otest test.cpp
Reading specs from /usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.0.1/specs
Configured with: /usr/local/build/gcc-3.0.1/configure
--build=hppa2.0n-hp-hpux11.00 --host=hppa2.0n-hp-hpux11.00 --with-gnu-as
--with-as=/usr/local/bin/as
Thread model: single
gcc version 3.0.1
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.0.1/cpp0 -lang-c++ -D__GNUG__=3
-D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -D__GNUC__=3
-D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=1 -Dhppa -Dhp9000s800 -D__hp9000s800
-Dhp9k8 -DPWB -Dhpux -Dunix -D__hppa__ -D__hp9000s800__ -D__hp9000s800
-D__hp9k8__ -D__PWB__ -D__hpux__ -D__unix__ -D__hppa -D__hp9000s800 -D__hp9k8
-D__PWB -D__hpux -D__unix -Asystem=unix -Asystem=hpux -Acpu=hppa -Amachine=hppa
-D__NO_INLINE__ -D__STDC_HOSTED__=1 -Wall -D_HPUX_SOURCE -D_HIUX_SOURCE
-D__STDC_EXT__ -D_PA_RISC1_1 -D__hp9000s700 test.cpp test.ii
GNU CPP version 3.0.1 (cpplib) (hppa)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/g++-v3
/usr/local/include/g++-v3/hppa2.0n-hp-hpux11.00
/usr/local/include/g++-v3/backward
/usr/local/include
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.0.1/include
/usr/local/hppa2.0n-hp-hpux11.00/include
/usr/include
End of search list.
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.0.1/cc1plus -fpreprocessed
test.ii -quiet -dumpbase test.cpp -Wall -version -o test.s
GNU CPP version 3.0.1 (cpplib) (hppa)
GNU C++ version 3.0.1 (hppa2.0n-hp-hpux11.00)
compiled by GNU C version 3.0.1.
/usr/local/bin/as --traditional-format -o test.o test.s
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.0.1/collect2 -L/lib/pa1.1
-L/usr/lib/pa1.1 -z -u main -otest /usr/lib/crt0.o -L/usr/local/lib
-L/home/jdmartin/local/lib -L/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.0.1
-L/usr/ccs/bin -L/usr/ccs/lib -L/opt/langtools/lib
-L/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.0.1/../../..
+vallcompatwarnings test.o -lstdc++ -lm -lgcc -lc -lgcc
test.ii.gz