This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/1743: iostream::seekg does not reset fail and eof bits
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/1743: iostream::seekg does not reset fail and eof bits
- From: tarot at chez dot com
- Date: 23 Jan 2001 14:30:03 -0000
- Reply-To: tarot at chez dot com
>Number: 1743
>Category: c++
>Synopsis: iostream::seekg does not reset fail and eof bits
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jan 23 06:36:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Stephane TAROT
>Release: g++ 2.95.2 19991024 and over
>Organization:
>Environment:
linux i686
>Description:
iostream::seekg does not clear the fail and eof bits
when accessing a good position after a bad one.
ie : if you seekg(0) after reaching the EOF, fail() and
eof() remains true.
Looking at the 20010115 snapshot of gcc 2.96, I think the
bug still exists.
(I'm French and I hope my english is clear enough)
>How-To-Repeat:
g++ main.cc -o main
main
>Fix:
If think that the solution is to add a clear() call
in the "else" part of the "if" statement in
iostream::seekg(streampos pos) and
iostream::seekg(streampos pos, _seek_dir dir)
in iostream.cc
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="main.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="main.cc"
I2luY2x1ZGUgPGlvc3RyZWFtLmg+CiNpbmNsdWRlIDxmc3RyZWFtLmg+CgppbnQgbWFpbih2b2lk
KQp7CiAgICBvZnN0cmVhbSBvc3RyKCJmb28iLCBpb3M6Om91dCB8IGlvczo6dHJ1bmMpOwogICAg
b3N0ciA8PCAiYWJjZCI7CiAgICBvc3RyLmNsb3NlKCk7CgogICAgaWZzdHJlYW0gaXN0cigiZm9v
Iik7CiAgICBjaGFyIGM7CgogICAgd2hpbGUgKCFpc3RyLmVvZigpKQoJaXN0ci5nZXQoYyk7Cgog
ICAgaXN0ci5zZWVrZygwKTsKCiAgICBjb3V0IDw8IGlzdHIuZmFpbCgpIDw8IGlzdHIuZW9mKCkg
PDwgZW5kbDsKCiAgICByZXR1cm4gMDsKfQo=