[patch, fortran] PR38291 Rejects I/O with POS= if FMT=*

jvdelisle@verizon.net jvdelisle@verizon.net
Tue Dec 2 04:32:00 GMT 2008


Hi all,

The attached patch fixes this problem by not artificially using the 
dtp->rec by matcher magic.  Instead, the front end sets the dtp->pos and 
passes that to the runtime library.  This avoids the bogus error 
meassge.

In the runtime library I then set dtp->rec = dtp->pos and add some 
runtime checks on the range that pos is given.  A runtime error is also 
given if the unit was not previously opened for stream access.  I will 
add in a test case based on the one in the PR.

Regression tested on x86-64-Gnu-Linux.

OK for trunk?

Regards,

Jerry

2008-12-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/38291
	* io.c (match_dt_element): Use dt->pos in matcher.
	(gfc_free_dt): Free dt->pos after use.
	(gfc_resolve_dt): Use dt->pos in resolution of stream position tag.
	
2008-12-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/38291
	* io/transfer.c (data_transfer_init): Add checks for POS= valid range.
	Add check for unit opened with ACCESS="stream". Flush and seek if
	current stream position does not match.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr38291.diff
Type: application/octet-stream
Size: 4095 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20081202/bfd81745/attachment.obj>


More information about the Fortran mailing list