From: Steven G. Kargl Date: Mon, 18 May 2015 21:04:33 +0000 (+0000) Subject: re PR fortran/66039 (ICE on incomplete parentheses at rewind, flush, endfile, backspace) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=20898e80960f5d27410c38f75ea5d412a26f753a;p=gcc.git re PR fortran/66039 (ICE on incomplete parentheses at rewind, flush, endfile, backspace) 2015-05-18 Steven G. Kargl PR fortran/66039 * io.c (match_filepos): Check for incomplete/mangled REWIND, FLUSH, BACKSPACE, and ENDFILE statements 2015-05-18 Steven G. Kargl PR fortran/66039 * gfortran.dg/filepos1.f90: New test From-SVN: r223315 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6913d881b09..a5d4d22df5d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-05-18 Steven G. Kargl + + PR fortran/66039 + * io.c (match_filepos): Check for incomplete/mangled REWIND, FLUSH, + BACKSPACE, and ENDFILE statements + 2015-05-18 Steven G. Kargl PR fortran/64925 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 82a0a871fd3..0ac4f4a03ad 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -2382,9 +2382,7 @@ match_filepos (gfc_statement st, gfc_exec_op op) if (m == MATCH_NO) { m = gfc_match_expr (&fp->unit); - if (m == MATCH_ERROR) - goto done; - if (m == MATCH_NO) + if (m == MATCH_ERROR || m == MATCH_NO) goto syntax; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 593427cdbf0..3dd2d94ecec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-05-18 Steven G. Kargl + + PR fortran/66039 + * gfortran.dg/filepos1.f90: New test + 2015-05-18 Steven G. Kargl PR fortran/64925 diff --git a/gcc/testsuite/gfortran.dg/filepos1.f90 b/gcc/testsuite/gfortran.dg/filepos1.f90 new file mode 100644 index 00000000000..d34902a4934 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/filepos1.f90 @@ -0,0 +1,25 @@ +! { dg-do compile } +! PR fortran/66039 +! +! Original code from Gerhard Steinmetz +! +subroutine p1 + rewind (( ! { dg-error "Syntax error in REWIND" } + rewind (- ! { dg-error "Syntax error in REWIND" } +end subroutine p1 + +subroutine p2 + flush (( ! { dg-error "Syntax error in FLUSH" } + flush (- ! { dg-error "Syntax error in FLUSH" } +end subroutine p2 + +subroutine p4 + backspace (( ! { dg-error "Syntax error in BACKSPACE" } + backspace (- ! { dg-error "Syntax error in BACKSPACE" } +end subroutine p4 + +subroutine p3 + endfile (( ! { dg-error "Expecting END SUBROUTINE" } + endfile (- ! { dg-error "Expecting END SUBROUTINE" } +end subroutine p3 +