public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/9761: filebuf::pbackfail discards previously put back characters
@ 2003-02-19 17:16 peturr02
  0 siblings, 0 replies; 2+ messages in thread
From: peturr02 @ 2003-02-19 17:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9761
>Category:       libstdc++
>Synopsis:       filebuf::pbackfail discards previously put back characters
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 19 17:16:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     peturr02@ru.is
>Release:        gcc-3.2.1
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
If filebuf::sputbackc is called twice in a row, the result of the first sputbackc is lost. It would be better for the second sputbackc to fail than to corrupt the stream. Even better would be to support up to gptr() - eback() put backs.
>How-To-Repeat:
See attachment.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="sputbackcbug3.cc"
Content-Disposition: inline; filename="sputbackcbug3.cc"

#include <fstream>

int main()
{
	using namespace std;

	filebuf fbuf;
	fbuf.open("sputbackcbug3.cc", ios_base::in);

	fbuf.sbumpc();
	fbuf.sbumpc();
	
	if (fbuf.sputbackc('a') == EOF)
		return 0;
	if (fbuf.sputbackc('b') == EOF)
		return 0;

	assert(fbuf.sbumpc() == 'b');
	assert(fbuf.sbumpc() == 'a');

	return 0;
}


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: libstdc++/9761: filebuf::pbackfail discards previously put back characters
@ 2003-02-22 16:24 paolo
  0 siblings, 0 replies; 2+ messages in thread
From: paolo @ 2003-02-22 16:24 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, peturr02

Synopsis: filebuf::pbackfail discards previously put back characters

State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Sat Feb 22 16:24:01 2003
State-Changed-Why:
    Confirmed. Seems however a known issue: grep for 'pbacks' in
    std_streambuf.h

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9761


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-02-22 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-19 17:16 libstdc++/9761: filebuf::pbackfail discards previously put back characters peturr02
2003-02-22 16:24 paolo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).