This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, libfortran] PR38430 [4.4 Regression]: gfortran.dg/streamio_1.f90, 10, 14, 2, 6 now fails
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>, Gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 06 Dec 2008 13:25:22 -0800
- Subject: [patch, libfortran] PR38430 [4.4 Regression]: gfortran.dg/streamio_1.f90, 10, 14, 2, 6 now fails
I do not have confirmation that this fixes the regression on this platform.
However, it is an obvious error of ommission.
Regression tested on x86-64-linux-gnu and I well commit under obvious and simple
rule. It is taken from the original code path for dt->rec which I duplicated
portions for dt->pos.
I am also adding a comment fixup and a simple runtime constraint check. REC=
can not be used with ACCESS="stream".
Regards,
Jerry
2008-12-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/38430
* io/transfer.c (data_transfer_init): Add fbuf_flush inadvertently
ommitted. Add check for invalid use of REC= with ACCESS="stream". Fix
comment.
Index: transfer.c
===================================================================
--- transfer.c (revision 142515)
+++ transfer.c (working copy)
@@ -1967,7 +1967,7 @@ data_transfer_init (st_parameter_dt *dtp
return;
}
- /* Check the record or position number. */
+ /* Check the record number. */
if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT
&& (cf & IOPARM_DT_HAS_REC) == 0)
@@ -1986,6 +1986,15 @@ data_transfer_init (st_parameter_dt *dtp
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. */
dtp->u.p.advance_status
@@ -2146,7 +2155,10 @@ data_transfer_init (st_parameter_dt *dtp
/* Required for compatibility between 4.3 and 4.4 runtime. Check
to see if we might be reading what we wrote before */
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))
dtp->u.p.current_unit->endfile = NO_ENDFILE;