This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/9424: i/ostream::operator>>/<<(streambuf*) drops characters
- From: paolo at gcc dot gnu dot org
- To: bkoz at redhat dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, ncm at cantrip dot org, nobody at gcc dot gnu dot org, paolo at gcc dot gnu dot org, peturr02 at ru dot is
- Date: 26 Feb 2003 00:34:54 -0000
- Subject: Re: libstdc++/9424: i/ostream::operator>>/<<(streambuf*) drops characters
- Reply-to: paolo at gcc dot gnu dot org, bkoz at redhat dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, ncm at cantrip dot org, nobody at gcc dot gnu dot org, paolo at gcc dot gnu dot org, peturr02 at ru dot is, gcc-gnats at gcc dot gnu dot org
Synopsis: i/ostream::operator>>/<<(streambuf*) drops characters
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Wed Feb 26 00:34:53 2003
Responsible-Changed-Why:
Analyzed.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Wed Feb 26 00:34:53 2003
State-Changed-Why:
The issue is the following: when a setg(buf, buf, buf + 10)
is missing, __copy_streambufs, called by operator>>, ends up
using sgetn to fill an internal temporary buffer.
The latter, in turn, calls unavoidably the custom uflow,
which moves 'current' past the end of the buffer, and
underflow, called by sgetc, does not return the expected
'1'.
Now, everything boild down to the following general
question: is an implementation of operator>> allowed to
call (indirectly) sgetn?
If so, the PR seems "only" a QoI issue, otherwise, a real
bug, which can be fixed in many ways. For example, avoiding
the call in __copy_streambufs (with a wrapper?)
Nathan? Benjamin?
Paolo.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9424