This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
iostream bug in g++ 2.95
- To: gcc-bugs at gcc dot gnu dot org
- Subject: iostream bug in g++ 2.95
- From: Dave Gomboc <dave at cs dot ualberta dot ca>
- Date: Wed, 24 Nov 1999 19:22:08 -0700 (MST)
Using gcc 2.95.1, redhat linux 6.0 on dual PII.
Bug report: c++ istream's getline reads more characters than it should...
according to The C++ Programming Language, 3rd edition (seventh printing),
by Bjarne Stroustrup, anyway. Expected behavior is to be able to read the
double and int from the first line of (the piped-in) test.input, after
reading off the name. What happens is the name gets read correctly, but
the double and the int are barfo. I think the reason is that the stream's
failbit is getting set: C++PL doesn't say that it should be set. Of
course, it's not the ISO C++ standard, but I don't have a copy of that to
reference.
The attached tar.gz includes
test.cpp -- source file
test.input -- some sample data to pipe into the program when you run it
test.ii
test.s -- these two generated by the command line
g++ -v --save-temps -Wall test.cpp
which gave the following output as it proceeded:
(I typed the below in manually, so there may be a typo or two)
Reading specs from /usr/opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/specs
gcc version 2.95.1 19990816 (release)
/usr/opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/cpp -lang-c++ -v
-D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__
-Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__
-D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Wall -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ -Dpentiumpro -D__i686
-D__i686__ -D__pentiumpeo -D__pentiumpro__ test.cpp test.ii
GNU CPP version 2.95.1 19990816 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/include/g++
/usr/local/include
/usr/opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/../../../../i686-pc-linux-gnu/include
/usr/opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
/usr/opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/cc1plus test.ii -quiet
-dumpbase test.cc -Wall -version -o test.s
GNU C++ version 2.95.1 19990816 (release) (i686-pc-linux-gnu) compiled by
GNU C version 2.95.1 19990816 (release).
as -V -Qy -o test.o test.s
GNU assembler version 2.9.1 (i386-redhat-linux), using BFD version 2.9.1.0.23
/usr/opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/collect2 -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o
/usr/opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/crtbegin.o
-L/usr/opt/gcc/lib/gcc-lib/i686-pc-linux/gnu/2.95.1 -L/usr/opt/gcc/lib
test.o -lstdc++ -lm -lgcc -lc -lgcc
/usr/opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/crtend.o /usr/lib/crtn.o
(the formatting got a bit whacked by the mail message editor too)
Dave
--
Dave Gomboc Graduate Student
Department of Computing Science Phone: (780)907-3214
University of Alberta Email: dave@cs.ualberta.ca
bug.tar.gz