This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/9439: filebuf::sputbackc ignores beginning-of-file
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: Pétur Runólfsson <peturr02 at ru dot is>
- Cc: paolo at gcc dot gnu dot org, bkoz at redhat dot com, gcc-bugs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Mon, 03 Feb 2003 15:21:09 +0100
- Subject: Re: libstdc++/9439: filebuf::sputbackc ignores beginning-of-file
- References: <07D05A69A3D0C14FAEA60C3ACE8E5564028F5517@nike.hir.is>
Pétur Runólfsson wrote:
Hi,
Hi. I don't think there is a bug here: I cannot find in the
standard a specific prescription for the behaviour you
expect (in particular in 27.5.2.4.4) Can you?
Yes. 27.8.1.4 [lib.filebuf.virtuals] p5 describes how pbackfail may
put back the character c. The only cases that can apply here are the
ones starting with
[snip]
Ok. I agree with your reading.
Therefore it seems that seekoff should be changed to return error in
this case. Then pbackfail would pay attention to the negative returned
value. The latter changes will also fix libstdc++/9425.
Indeed, sputbackc calls, as expected, pbackfail, which in
turns calls seekoff (fstream.tcc, line 218) (pay attention
to the preceding comment which means that this specific
situation was considered and _not_ supposed to lead to an
obvious failure).
I read "at the beginning of the buffer" as simply meaning that
gptr() == eback(), not as "at the beginning of the file".
Yes, you are right.
Paolo.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9439