http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47694
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-02-14
15:13:44 UTC ---
If one enables fbuf debugging (FBUF_DEBUG in fbuf.c), one sees:
fbuf_read done: fbuf_debug pos: 0, act: 14, buf: ''LINE 1
LINE 2
''
Then the expected:
1 LINE 1
is printed.
The next call to fbuf_read shows the correct buffer, which could directly be
used:
fbuf_read, len 1024: fbuf_debug pos: 0, act: 7, buf: ''LINE 2
''
But nevertheless, sread is invoked again:
fbuf_alloc len 1024, fbuf_debug pos: 0, act: 7, buf: ''LINE 2
''
reading 1017 bytes starting at 7 fbuf_debug pos: 0, act: 1024, buf: ''LINE 2
LINE 2