libstdc++/9424: i/ostream::operator>>/<<(streambuf*) drops characters

paolo@gcc.gnu.org paolo@gcc.gnu.org
Wed Feb 26 00:34:00 GMT 2003


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



More information about the Gcc-bugs mailing list