[patch, libfortran] PR44477 Sequential I/O with END FILE: File position should be at EoF

Jerry DeLisle jvdelisle@verizon.net
Fri Jun 18 08:18:00 GMT 2010


Hi,

This patch adds checks and issues errors if ENDFILE is executed when the file is 
already positioned after thee EOF marker.  It also gives errors if a read or 
write is attempted when positioned after the EOF marker.

Another problem is that ENDFILE should create the file if it does not exist.

Regression tested on x86-64-gnu-linux.  Test cases provided.

OK for trunk?

Regards,

Jerry

2010-06-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR libfortran/44477
	* io/file_pos.c (st_endfile): Add check for ENDFILE when file is
	already positioned after the EOF marker. Use find_or_create_unit
	instead of find_unit. If unit is not connected, connect it and create
	the file with default settings.
	* io/transfer.c (data_transfer_init):  Add check for attempted READ or
	WRITE when file is already positioned after the EOF marker.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr44477.diff
Type: text/x-patch
Size: 3416 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100618/7e6137ee/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: endfile_2.f90
Type: text/x-fortran
Size: 287 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100618/7e6137ee/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: endfile_3.f90
Type: text/x-fortran
Size: 284 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100618/7e6137ee/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: endfile_4.f90
Type: text/x-fortran
Size: 270 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100618/7e6137ee/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eof_3.f90
Type: text/x-fortran
Size: 251 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100618/7e6137ee/attachment-0004.bin>


More information about the Gcc-patches mailing list