diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2006-07-22 03:14:27 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2006-07-22 03:14:27 +0000 |
commit | 397bc09a6539e72c1e93b7e9fa48870037ba5136 (patch) | |
tree | 46c726c03cdacc28c36000c52ab2b61a3090e6a7 /libgfortran/io | |
parent | 105395ad98c7d9c0141603aa84773af5dd08a461 (diff) | |
download | gcc-397bc09a6539e72c1e93b7e9fa48870037ba5136.zip gcc-397bc09a6539e72c1e93b7e9fa48870037ba5136.tar.gz gcc-397bc09a6539e72c1e93b7e9fa48870037ba5136.tar.bz2 |
re PR fortran/28339 (gfortran misses a record from a format statement)
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/unit.c (get_internal_unit): Initialize iunit->endfile for internal
unit.
From-SVN: r115670
Diffstat (limited to 'libgfortran/io')
-rw-r--r-- | libgfortran/io/transfer.c | 13 | ||||
-rw-r--r-- | libgfortran/io/unit.c | 1 |
2 files changed, 10 insertions, 4 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 9b91536..4efb523 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -414,6 +414,9 @@ write_block (st_parameter_dt *dtp, int length) 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; @@ -2052,9 +2055,6 @@ next_record_w (st_parameter_dt *dtp, int done) case FORMATTED_SEQUENTIAL: - if (dtp->u.p.current_unit->bytes_left == 0) - break; - if (is_internal_unit (dtp)) { if (is_array_io (dtp)) @@ -2083,7 +2083,9 @@ next_record_w (st_parameter_dt *dtp, int done) /* 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; @@ -2124,6 +2126,9 @@ next_record_w (st_parameter_dt *dtp, int done) } 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) */ diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index 0b7dee1..eca1b1e 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -420,6 +420,7 @@ get_internal_unit (st_parameter_dt *dtp) iunit->flags.form = FORM_FORMATTED; iunit->flags.pad = PAD_YES; iunit->flags.status = STATUS_UNSPECIFIED; + iunit->endfile = NO_ENDFILE; /* Initialize the data transfer parameters. */ |