aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2017-05-15 23:48:39 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2017-05-15 23:48:39 +0000
commita5768d38a66fc4136208bc8442a4118df2bd588f (patch)
treeaae6a5d219e2a2328d5b0eca6f9178cbe3e6fd86 /libgfortran
parentb2954e124bc411b0b9d8f5f7b4fe2e50f241bbd0 (diff)
downloadgcc-a5768d38a66fc4136208bc8442a4118df2bd588f.zip
gcc-a5768d38a66fc4136208bc8442a4118df2bd588f.tar.gz
gcc-a5768d38a66fc4136208bc8442a4118df2bd588f.tar.bz2
re PR libfortran/80727 (Crash of runtime gfortran library during integer transformation)
2017-05-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/80727 * transfer.c (read_sf_internal): Remove bogus code to detect EOR. (read_block_form): For internal units, generate EOR if no more bytes left in unit and we are trying to read with ADVANCE='NO'. * gfortran.dg/read_3.f90: New test. From-SVN: r248080
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog7
-rw-r--r--libgfortran/io/transfer.c27
2 files changed, 24 insertions, 10 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 8a5d803..b604147 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,10 @@
+2017-05-15 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/80727
+ * transfer.c (read_sf_internal): Remove bogus code to detect EOR.
+ (read_block_form): For internal units, generate EOR if no more
+ bytes left in unit and we are trying to read with ADVANCE='NO'.
+
2017-05-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/80765
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index f16d8c5..928a448 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;