[Bug fortran/47694] [4.3/4.4/4.5/4.6 Regression] Fortran read from named pipe fails to read all available data
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 14 21:32:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47694
--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-02-14 21:23:27 UTC ---
The data is read via:
read_a -> read_block_form -> read_sf -> fbuf_read
read_sf has the nice comment: "When reading sequential formatted records we
have a problem. We don't know how long the line is until we read the trailing
newline, and we don't want to read too much. [...] Given this, the solution is
to read a byte at a time, stopping if we hit the newline."
However, the first action it does is:
/* Read data into format buffer and scan through it. */
lorig = *length;
base = p = fbuf_read (dtp->u.p.current_unit, length);
length is 1024 (cf. comment 0). Thus, [if (oldpos + *len > oldact)], it invokes
sread.
I think the solution is to read from the buffer until its end - and then call,
if needed, fbuf_read for the remaining "length-already_read" characters.
(I do not see whether there are additional issues, but this should solve at
least one issue.)
More information about the Gcc-bugs
mailing list