From 46b6b3542d8c47e285e4e606f889411e4739a886 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Mon, 18 May 2015 21:16:05 +0000 Subject: [PATCH] re PR fortran/66040 (ICE on misplaced sequence in function) 2015-05-18 Steven G. Kargl PR fortran/66040 * parse.c(verify_st_order): Replace a gfc_internal_error with your generic gfc_error. 2015-05-18 Steven G. Kargl PR fortran/66040 * gfortran.dg/misplaced_statement.f90: New test. From-SVN: r223318 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/parse.c | 3 +-- gcc/testsuite/ChangeLog | 5 +++++ .../gfortran.dg/misplaced_statement.f90 | 20 +++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/misplaced_statement.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a5d4d22df5d..1c66684ecbe 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-05-18 Steven G. Kargl + + PR fortran/66040 + * parse.c(verify_st_order): Replace a gfc_internal_error with your + generic gfc_error. + 2015-05-18 Steven G. Kargl PR fortran/66039 diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 30e4eabc557..3135d9af797 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3dd2d94ecec..38f7ac1c2a8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-05-18 Steven G. Kargl + + PR fortran/66040 + * gfortran.dg/misplaced_statement.f90: New test. + 2015-05-18 Steven G. Kargl 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 index 00000000000..63f33422ffc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/misplaced_statement.f90 @@ -0,0 +1,20 @@ +!{ dg-do compile } +! PR fortran/66040 +! +! Original code from Gerhard Steinmetz +! +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 -- 2.30.2