diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2015-10-02 00:49:28 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2015-10-02 00:49:28 +0000 |
commit | 220ab6b433ee3a360c52032445676758991ed7d9 (patch) | |
tree | 02754e54539199603e6cddc52673d2a6e442426e /gcc/fortran/io.c | |
parent | b64c3d0696c572b7fc21fecfd78b9aaadf2b4892 (diff) | |
download | gcc-220ab6b433ee3a360c52032445676758991ed7d9.zip gcc-220ab6b433ee3a360c52032445676758991ed7d9.tar.gz gcc-220ab6b433ee3a360c52032445676758991ed7d9.tar.bz2 |
re PR fortran/66979 (gfortran internal compiler error with malformed FLUSH statement)
2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66979
* io.c (gfc_resolve_filepos): Check for a UNIT number. Add a nearby
missing 'return false'.
2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66979
gfortran.dg/pr66979.f90: new test.
From-SVN: r228364
Diffstat (limited to 'gcc/fortran/io.c')
-rw-r--r-- | gcc/fortran/io.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index cff2b68..e5d68fb 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -2515,12 +2515,21 @@ gfc_resolve_filepos (gfc_filepos *fp) if (!gfc_reference_st_label (fp->err, ST_LABEL_TARGET)) return false; + if (!fp->unit && (fp->iostat || fp->iomsg)) + { + locus where; + where = fp->iostat ? fp->iostat->where : fp->iomsg->where; + gfc_error ("UNIT number missing in statement at %L", &where); + return false; + } + if (fp->unit->expr_type == EXPR_CONSTANT && fp->unit->ts.type == BT_INTEGER && mpz_sgn (fp->unit->value.integer) < 0) { gfc_error ("UNIT number in statement at %L must be non-negative", &fp->unit->where); + return false; } return true; |