This is obvious.

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

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

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

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

svn commit gcc/fortran/io.c gcc/fortran/ChangeLog gcc/testsuite/ChangeLog \
    gcc/testsuite/gfortran.dg/pr91587.f90


Index: gcc/fortran/io.c
===================================================================
--- gcc/fortran/io.c    (revision 275048)
+++ gcc/fortran/io.c    (working copy)
@@ -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: gcc/testsuite/gfortran.dg/pr91587.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr91587.f90       (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr91587.f90       (working copy)
@@ -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

-- 
Steve

Reply via email to