Commit 97b14ba8 by Jerry DeLisle

re PR fortran/38291 (Rejects I/O with POS= if FMT=*)

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

	PR libfortran/38291
	* io/transfer.c (data_transfer_init): Add fbuf_flush inadvertently
	ommitted.  Add check for invalid use of REC= with ACCESS="stream".  Fix
	comment.

From-SVN: r142528
parent f11bea25
2008-12-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/38291
* io/transfer.c (data_transfer_init): Add fbuf_flush inadvertently
ommitted. Add check for invalid use of REC= with ACCESS="stream". Fix
comment.
2008-12-06 Adam Nemet <anemet@caviumnetworks.com> 2008-12-06 Adam Nemet <anemet@caviumnetworks.com>
* runtime/main.c (store_exe_path): Don't crash if argv0 is NULL. * runtime/main.c (store_exe_path): Don't crash if argv0 is NULL.
......
...@@ -1967,7 +1967,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) ...@@ -1967,7 +1967,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
return; return;
} }
/* Check the record or position number. */ /* Check the record number. */
if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT
&& (cf & IOPARM_DT_HAS_REC) == 0) && (cf & IOPARM_DT_HAS_REC) == 0)
...@@ -1986,6 +1986,15 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) ...@@ -1986,6 +1986,15 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
return; return;
} }
if (dtp->u.p.current_unit->flags.access == ACCESS_STREAM
&& (cf & IOPARM_DT_HAS_REC) != 0)
{
generate_error (&dtp->common, LIBERROR_OPTION_CONFLICT,
"Record number not allowed for stream access "
"data transfer");
return;
}
/* Process the ADVANCE option. */ /* Process the ADVANCE option. */
dtp->u.p.advance_status dtp->u.p.advance_status
...@@ -2146,7 +2155,10 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) ...@@ -2146,7 +2155,10 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
/* Required for compatibility between 4.3 and 4.4 runtime. Check /* Required for compatibility between 4.3 and 4.4 runtime. Check
to see if we might be reading what we wrote before */ to see if we might be reading what we wrote before */
if (dtp->u.p.current_unit->mode == WRITING) if (dtp->u.p.current_unit->mode == WRITING)
flush(dtp->u.p.current_unit->s); {
fbuf_flush (dtp->u.p.current_unit, 1);
flush(dtp->u.p.current_unit->s);
}
if (dtp->pos < file_length (dtp->u.p.current_unit->s)) if (dtp->pos < file_length (dtp->u.p.current_unit->s))
dtp->u.p.current_unit->endfile = NO_ENDFILE; dtp->u.p.current_unit->endfile = NO_ENDFILE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment