re PR fortran/91587 (ICE in gfc_resolve_filepos, at fortran/io.c:2913)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 31 Aug 2019 00:32:48 +0000 (00:32 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 31 Aug 2019 00:32:48 +0000 (00:32 +0000)
2019-08-30  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91587
* io.c (match_filepos): MATCH_ERROR should branch to a syntax error.

2019-08-30  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91587
* gfortran.dg/pr91587.f90: New test.

From-SVN: r275236

gcc/fortran/ChangeLog
gcc/fortran/io.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr91587.f90 [new file with mode: 0644]

index 0f2efb239acd2278e4d24d1ea09818b44ce84e32..a34b871c4c4725f752f6c91ee65ed4cd607cfe2e 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-30  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/91587
+       * io.c (match_filepos): MATCH_ERROR should branch to a syntax error.
+
 2019-08-28  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/91551
index cd21c6bcf82f1d779b16fb57c2a9e84896fc9bec..632e168809d6773b5b5a1308da584d3fcb0bd8a2 100644 (file)
@@ -2845,7 +2845,7 @@ match_filepos (gfc_statement st, gfc_exec_op op)
 
   m = match_file_element (fp);
   if (m == MATCH_ERROR)
-    goto done;
+    goto syntax;
   if (m == MATCH_NO)
     {
       m = gfc_match_expr (&fp->unit);
index 83d17a38f6c6fb3f50453951d1b085d33976e6b1..c590b46f65f4c8d35d227c3e81f70c86d8a5d612 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-30  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/91587
+       * gfortran.dg/pr91587.f90: New test.
+
 2019-08-30  Martin Sebor  <msebor@redhat.com>
 
        PR middle-end/91599
diff --git a/gcc/testsuite/gfortran.dg/pr91587.f90 b/gcc/testsuite/gfortran.dg/pr91587.f90
new file mode 100644 (file)
index 0000000..c07735d
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! PR fortran/91587
+! Code contributed by Gerhard Steinmetz
+program p
+   backspace(err=!)  ! { dg-error "Syntax error in" }
+   flush(err=!)      ! { dg-error "Syntax error in" }
+   rewind(err=!)     ! { dg-error "Syntax error in" }
+end
+
+subroutine bar       ! An other matcher runs, and gives a different error.
+   endfile(err=!)    ! { dg-error "Expecting END" }
+end