re PR fortran/66040 (ICE on misplaced sequence in function)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 18 May 2015 21:16:05 +0000 (21:16 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 18 May 2015 21:16:05 +0000 (21:16 +0000)
2015-05-18  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/66040
* parse.c(verify_st_order): Replace a gfc_internal_error with your
generic gfc_error.

2015-05-18  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/66040
* gfortran.dg/misplaced_statement.f90: New test.

From-SVN: r223318

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

index a5d4d22df5d7adb1a55eecc9034e2e1d4a68a339..1c66684ecbe3770a46662bf26fe51b450026a508 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-18  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/66040
+       * parse.c(verify_st_order): Replace a gfc_internal_error with your
+       generic gfc_error.
+
 2015-05-18  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/66039
index 30e4eabc557f9c267cf1db7bf0cd5f0d1ea72fa8..3135d9af7976bfb479e411179f3b6dc6465caf20 100644 (file)
@@ -2425,8 +2425,7 @@ verify_st_order (st_state *p, gfc_statement st, bool silent)
       break;
 
     default:
-      gfc_internal_error ("Unexpected %s statement in verify_st_order() at %C",
-                         gfc_ascii_statement (st));
+      return false;
     }
 
   /* All is well, record the statement in case we need it next time.  */
index 3dd2d94ececa2e45d4e2385dbf008a75fdf29b8a..38f7ac1c2a82a7ac8fdba5301a0376fbbd966792 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-18  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/66040
+       * gfortran.dg/misplaced_statement.f90: New test.
+
 2015-05-18  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/66039
diff --git a/gcc/testsuite/gfortran.dg/misplaced_statement.f90 b/gcc/testsuite/gfortran.dg/misplaced_statement.f90
new file mode 100644 (file)
index 0000000..63f3342
--- /dev/null
@@ -0,0 +1,20 @@
+!{ dg-do compile }
+! PR fortran/66040
+!
+! Original code from Gerhard Steinmetz
+! <gerhard dot steinmetz dot fortran at t-online dot de>
+real function f1(x)
+   sequence          ! { dg-error "Unexpected SEQUENCE statement" }
+end function f1
+
+real function f2()
+   else              ! { dg-error "Unexpected ELSE statement" }
+end function f2
+
+real function f3()
+   block data        ! { dg-error "Unexpected BLOCK DATA statement" }
+end function f3
+
+real function f4()
+   program p         ! { dg-error "Unexpected PROGRAM statement" }
+end function f4