public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/9825: filebuf::sputbackc breaks sbumpc
@ 2003-02-24  9:16 peturr02
  0 siblings, 0 replies; 3+ messages in thread
From: peturr02 @ 2003-02-24  9:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9825
>Category:       libstdc++
>Synopsis:       filebuf::sputbackc breaks sbumpc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 24 09: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:
Given the following:
filebuf fb;
[...]
fb.sputbackc('x');
fb.sbumpc();
fb.sbumpc(); // 1
fb.sbumpc(); // 2
The sbumpc in line 1 doesn't advance the read position, causing the sbumpc in line 2 to return the same character, instead of the next one.
>How-To-Repeat:
See attachment.
>Fix:

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

#include <fstream>
#include <cstdio>

#undef NDEBUG
#include <cassert>

int main()
{
	using namespace std;

	const char* str = "0123456789";
	
	FILE* fout = fopen("tmp", "w");
	fputs(str, fout);
	fclose(fout);

	filebuf fbuf;
	fbuf.open("tmp", ios_base::in);
	fbuf.sbumpc();
	fbuf.sputbackc('x');
	int c = fbuf.sbumpc();
	assert(c == 'x');
	c = fbuf.sbumpc();
	assert(c == '1');
	c = fbuf.sbumpc();
	assert(c == '2');
	fbuf.close();

	return 0;
}


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

* Re: libstdc++/9825: filebuf::sputbackc breaks sbumpc
@ 2003-02-25 12:40 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-02-25 12:40 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, paolo, peturr02

Synopsis: filebuf::sputbackc breaks sbumpc

State-Changed-From-To: analyzed->closed
State-Changed-By: paolo
State-Changed-When: Tue Feb 25 12:40:13 2003
State-Changed-Why:
    Fixed for 3.3 and 3.4.

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


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

* Re: libstdc++/9825: filebuf::sputbackc breaks sbumpc
@ 2003-02-24 13:23 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-02-24 13:23 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, paolo, peturr02

Synopsis: filebuf::sputbackc breaks sbumpc

Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Mon Feb 24 13:23:38 2003
Responsible-Changed-Why:
    Patching.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Mon Feb 24 13:23:38 2003
State-Changed-Why:
    Confirmed. Seems quite easy to fix (last famous words ;)

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


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

end of thread, other threads:[~2003-02-25 12:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-24  9:16 libstdc++/9825: filebuf::sputbackc breaks sbumpc peturr02
2003-02-24 13:23 paolo
2003-02-25 12:40 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).