diff options
Diffstat (limited to 'libgfortran/io/transfer.c')
-rw-r--r-- | libgfortran/io/transfer.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index f16d8c55f6d..928a448f74c 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -272,12 +272,6 @@ read_sf_internal (st_parameter_dt *dtp, int *length) return NULL; } - if (base && *base == 0) - { - generate_error (&dtp->common, LIBERROR_EOR, NULL); - return NULL; - } - dtp->u.p.current_unit->bytes_left -= *length; if (((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0) || @@ -470,11 +464,24 @@ read_block_form (st_parameter_dt *dtp, int *nbytes) } } - if (unlikely (dtp->u.p.current_unit->bytes_left == 0 - && !is_internal_unit(dtp))) + if (is_internal_unit(dtp)) { - hit_eof (dtp); - return NULL; + if (*nbytes > 0 && dtp->u.p.current_unit->bytes_left == 0) + { + if (dtp->u.p.advance_status == ADVANCE_NO) + { + generate_error (&dtp->common, LIBERROR_EOR, NULL); + return NULL; + } + } + } + else + { + if (unlikely (dtp->u.p.current_unit->bytes_left == 0)) + { + hit_eof (dtp); + return NULL; + } } *nbytes = dtp->u.p.current_unit->bytes_left; |