[patch,libgfortran] Fix PR29277 Formated stream output

Jerry DeLisle jvdelisle@verizon.net
Fri Oct 13 03:24:00 GMT 2006


:ADDPATCH fortran:

This patch utilizes the existing routines for sequential formatted reads and 
writes modified to update the STREAM position pointer.  The effect of this is to 
get the '\n' or '\r\n' in the right spots after the formatted I/O.

I have not tested this with a system that actually uses CR-LF, so I need someone 
to do that if possible.

I have included a minor fix in eat_separator.  The unget_char is only one 
character deep so there is no point to two ungets in a row.  The previous code 
was actually tossing out a potential non separator character if it followed a 
'\r' by itself. (It should never see that, but nevertheless I fixed it.)

Revised test case streamio_4.f90 and new test case streamio_11.f90 provided by 
Tobias Burnus attached.  Much appreciation to Tobias for identifying these 
issues and giving a test case.

Regression tested on the latest svn trunk on i686-linux.

OK to commit after passing the CR-LF tests?

Regards,

Jerry

2006-10-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/29277
	* io/list_read.c (next_char): Update strm_pos.
	(eat_separator): Delete extra call to unget_char.
	* io/transfer.c (read_block): Use read_sf for formatted stream I/O.
	(next_record_r): Update strm_pos for formatted stream I/O and handle
	end-of-record correctly.
	(next_record_w): Ditto.
	(next_record): Enable next record (r/w) functions and update strm_pos.
	(finalize_transfer): Call next_record to finish the record.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr29277.diff
Type: text/x-patch
Size: 5698 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061013/0aeca7bf/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamio_4.f90
Type: text/x-fortran
Size: 856 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061013/0aeca7bf/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamio_11.f90
Type: text/x-fortran
Size: 1329 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061013/0aeca7bf/attachment-0002.bin>


More information about the Gcc-patches mailing list