+2006-07-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/28339
+ * io/transfer.c (next_record_w): Use next_array_record result to set
+ END_FILE. (write_block): Test for END_FILE before the next write occurs.
+ * io/init.c (get_internal_unit): Initialize iunit->endfile for internal
+ unit.
+
2006-07-19 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/27919
return NULL;
}
+ if (is_internal_unit (dtp) && dtp->u.p.current_unit->endfile == AT_ENDFILE)
+ generate_error (&dtp->common, ERROR_END, NULL);
+
if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0)
dtp->u.p.size_used += (gfc_offset) length;
case FORMATTED_SEQUENTIAL:
- if (dtp->u.p.current_unit->bytes_left == 0)
- break;
-
if (is_internal_unit (dtp))
{
if (is_array_io (dtp))
/* Now that the current record has been padded out,
determine where the next record in the array is. */
record = next_array_record (dtp, dtp->u.p.current_unit->ls);
-
+ if (record == 0)
+ dtp->u.p.current_unit->endfile = AT_ENDFILE;
+
/* Now seek to this record */
record = record * dtp->u.p.current_unit->recl;
}
else
{
+ if (dtp->u.p.current_unit->bytes_left == 0)
+ break;
+
/* If this is the last call to next_record move to the farthest
position reached in preparation for completing the record.
(for file unit) */
iunit->flags.form = FORM_FORMATTED;
iunit->flags.pad = PAD_YES;
iunit->flags.status = STATUS_UNSPECIFIED;
+ iunit->endfile = NO_ENDFILE;
/* Initialize the data transfer parameters. */