[Bug libfortran/20930] [4.0 Regression] gfortran.dg/backspace.f execution test

dje at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Apr 26 18:35:00 GMT 2005


------- Additional Comments From dje at gcc dot gnu dot org  2005-04-26 18:33 -------
The problem is due to libgfortran not flushing the record length marker to the 
file.  transfer.c:next_record_w() copies the record length into the buffer, 
but does not ensure that the buffer gets flushed to the file.  At a later 
point, libgfortran seeks past the file position and then back, which the UNIX 
standard allows the OS to fill with zeroes.  next_record_w() calls sfree(), 
but sfree() specifically does not flush the buffer if operating on the 
small_buffer in the unix_stream structure or the stream is buffered.  
Presumably when switching from writing to reading, the buffer should be 
flushed.

The call to REWIND sets the mode to reading and truncates the file before the 
call to flush in data_transfer_init() could occur.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20930



More information about the Gcc-bugs mailing list