Bug 12296 - istream::peek() doesn't set eofbit
Summary: istream::peek() doesn't set eofbit
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.3.2
Assignee: Paolo Carlini
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-16 08:30 UTC by Pétur Runólfsson
Modified: 2003-09-30 14:38 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2003-09-16 08:51:06


Attachments
Test case (162 bytes, text/plain)
2003-09-16 08:30 UTC, Pétur Runólfsson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pétur Runólfsson 2003-09-16 08:30:02 UTC
Unformatted input functions should set eofbit in rdstate() when
rdbuf()->sgetc() or rdbuf()->sbumpc() return eof(), but
basic_istream::peek() fails to do so.
Comment 1 Pétur Runólfsson 2003-09-16 08:30:30 UTC
Created attachment 4769 [details]
Test case
Comment 2 Paolo Carlini 2003-09-16 08:51:05 UTC
Confirmed.
Comment 3 GCC Commits 2003-09-29 17:36:27 UTC
Subject: Bug 12296

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	paolo@gcc.gnu.org	2003-09-29 17:36:18

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/include/bits: istream.tcc stl_algo.h 
Added files:
	libstdc++-v3/testsuite/27_io/basic_istream/peek/char: 12296.cc 
	libstdc++-v3/testsuite/25_algorithms/search_n: 11400.cc 

Log message:
	2003-09-29  Paolo Carlini  <pcarlini@unitus.it>
	
	PR libstdc++/12296
	* include/bits/istream.tcc (peek): Set eofbit if sgetc
	returns eof.
	* testsuite/27_io/basic_istream/peek/char/12296.cc:
	New, from the PR.
	
	2003-09-29  Nathan Myers  <ncm@cantrip.org>
	Paolo Carlini  <pcarlini@unitus.it>
	
	PR libstdc++/11400
	* include/bits/stl_algo.h (search_n):
	Use iterator_traits<>::difference_type for __n.
	* testsuite/25_algorithms/search_n/11400.cc: New, from the PR.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.1973&r2=1.1974
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/istream.tcc.diff?cvsroot=gcc&r1=1.50&r2=1.51
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/stl_algo.h.diff?cvsroot=gcc&r1=1.35&r2=1.36
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_istream/peek/char/12296.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/25_algorithms/search_n/11400.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 4 Andrew Pinski 2003-09-29 17:49:02 UTC
Fixed by the patch above.
Comment 5 GCC Commits 2003-09-30 14:37:44 UTC
Subject: Bug 12296

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	paolo@gcc.gnu.org	2003-09-30 14:37:40

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/include/bits: istream.tcc stl_algo.h 

Log message:
	2003-09-30  Paolo Carlini  <pcarlini@unitus.it>
	
	PR libstdc++/12296
	* include/bits/istream.tcc (peek): Set eofbit if sgetc
	returns eof.
	
	2003-09-30  Nathan Myers  <ncm@cantrip.org>
	Paolo Carlini  <pcarlini@unitus.it>
	
	PR libstdc++/11400
	* include/bits/stl_algo.h (search_n):
	Use iterator_traits<>::difference_type for __n.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.1464.2.147&r2=1.1464.2.148
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/istream.tcc.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.36.4.6&r2=1.36.4.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/stl_algo.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.27&r2=1.27.20.1