diff options
Diffstat (limited to 'libgfortran/io/transfer.c')
-rw-r--r-- | libgfortran/io/transfer.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 43af8fbc938..054217daa79 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -272,6 +272,13 @@ read_block (st_parameter_dt *dtp, int *length) } } + if (dtp->u.p.current_unit->bytes_left == 0) + { + dtp->u.p.current_unit->endfile = AT_ENDFILE; + generate_error (&dtp->common, ERROR_END, NULL); + return; + } + *length = dtp->u.p.current_unit->bytes_left; } @@ -328,6 +335,13 @@ read_block_direct (st_parameter_dt *dtp, void *buf, size_t *nbytes) } } + if (dtp->u.p.current_unit->bytes_left == 0) + { + dtp->u.p.current_unit->endfile = AT_ENDFILE; + generate_error (&dtp->common, ERROR_END, NULL); + return; + } + *nbytes = dtp->u.p.current_unit->bytes_left; } |