This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/24217] filebuf.open call sets the error bits incorrectly
- From: "hemasai at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Oct 2005 18:12:49 -0000
- Subject: [Bug libstdc++/24217] filebuf.open call sets the error bits incorrectly
- References: <bug-24217-11468@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from hemasai at yahoo dot com 2005-10-06 18:12 -------
sample code:
fn(const char* fname)
{
ifstream fstr;
if (!fname)
return;
fstr.clear();
fstr.open(fname, ios::in | ios::nocreate);
if (!(fstr.is_open())) {
cout << "rdstate():" << fstr.rdstate();
cout << "bad():" << fstr.bad();
cout << "fail():" << fstr.fail();
return;
}
//Read the file contents
}
As you can see, the fstr is a stack variable that is used to access the file.
The flags were cleared before the open call. When it failed rdstate was set to
4.
This function call successfully opened the file multiple times before the
failure.
--
hemasai at yahoo dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |UNCONFIRMED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24217