This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++/9439: filebuf::sputbackc ignores beginning-of-file


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]