[patch, libgfortran] PR31099 [4.3/4.2 regression] Runtime error on legal code using RECL

Jerry DeLisle jvdelisle@verizon.net
Fri Mar 9 21:39:00 GMT 2007


:ADDPATCH fortran:

Hi,

This patch fixes the problem by doing two things:

First, it properly initializes the bytes_left and recl_subrecord in st_open and 
updates these properly in next_record_r and next_record_w.

Second, fixes the test for exceeding the current record length.  This resolves 
the incorrect error for reads when RECL is specified.  If you look at the 
original code, you will see that no matter what, if RECL was specified, an error 
would be issued.

I think one of the contributing factors is that setting the bytes_left correctly 
in gfortran 4.1 relied on falling through in the switch case in next_record, so 
it was set farther down.

Regression tested on x86-64-Linux.  I would suggest we get this into 4.2 
immediately as well as 4.3  I will clean up and dejagnuize the test case while 
this is being reviewed.

Awaiting approval.

Regards,

Jerry

2007-03-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/31099
	* io/open.c (new_unit): Initialize bytes_left and recl_subrecord.
	* io/transfer.c (next_record_w): Set bytes left to record length for
	sequential unformatted I/O.
	(next_record_r): Ditto.
	(read_block_direct): Fix test for exceeding bytes_left.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr31099.diff
Type: text/x-patch
Size: 1540 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070309/9b95e1b7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr31099.f90
Type: text/x-fortran
Size: 251 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070309/9b95e1b7/attachment-0001.bin>


More information about the Gcc-patches mailing list