+2016-09-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/77707
+ * gfortran.dg/inquire_17.f90: New test.
+
2016-09-29 Steven G. Kargl <kargl@gcc.gnu.org>
Backport from trunk
--- /dev/null
+! { dg-do run }
+! PR77707 formatted direct access: nextrec off by one
+program directaccess_formatted
+ integer nextrec
+ open(10, status='scratch', form='formatted', access='direct', recl=10*4)
+ write(10,'(10i4)',rec=9) 1,2,3,4,5,6,7,8,9,10
+ inquire(unit=10,nextrec=nextrec)
+ if (nextrec.ne.10) call abort
+ close(10)
+end
+2016-09-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/77707
+ io/transfer.c (next_record): Flush before calculating next_record.
+ Correctly calculate.
+
2016-09-29 Steven G. Kargl <kargl@gcc.gnu.org>
Backport from trunk
else
next_record_w (dtp, done);
+ fbuf_flush (dtp->u.p.current_unit, dtp->u.p.mode);
+
if (!is_stream_io (dtp))
{
/* Since we have changed the position, set it to unspecified so
fp = stell (dtp->u.p.current_unit->s);
/* Calculate next record, rounding up partial records. */
dtp->u.p.current_unit->last_record =
- (fp + dtp->u.p.current_unit->recl - 1) /
- dtp->u.p.current_unit->recl;
+ (fp + dtp->u.p.current_unit->recl) /
+ dtp->u.p.current_unit->recl - 1;
}
else
dtp->u.p.current_unit->last_record++;
if (!done)
pre_position (dtp);
- fbuf_flush (dtp->u.p.current_unit, dtp->u.p.mode);
smarkeor (dtp->u.p.current_unit->s);
}