From c52eae8de072141afe6620df1ccd2803f86771ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tobias=20Schl=C3=BCter?= Date: Sat, 12 Jun 2004 17:02:01 +0200 Subject: [PATCH] re PR fortran/14957 (testsuite issues) fortran/ PR fortran/14957 * decl.c (gfc_match_end): Require END {SUBROUTINE|FUNCTION} for contained procedure. testsuite/ PR fortran/14957 * gfortran.fortran-torture/execute/stack_varsize.f90: Correct syntax errors in end statements of contained subroutines. From-SVN: r83031 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/decl.c | 7 ++++++- gcc/testsuite/ChangeLog | 6 ++++++ .../gfortran.fortran-torture/execute/stack_varsize.f90 | 4 ++-- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e7b63f7e2a9..a823c8a2a59 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2004-06-12 Tobias Schlueter + + PR fortran/14957 + * decl.c (gfc_match_end): Require END {SUBROUTINE|FUNCTION} for + contained procedure. + 2004-06-12 Tobias Schlueter PR fortran/12841 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 69b1cfdb5c3..c6b8073edd5 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1875,10 +1875,15 @@ gfc_match_end (gfc_statement * st) if (gfc_match_eos () == MATCH_YES) { + state = gfc_current_state (); if (*st == ST_ENDIF || *st == ST_ENDDO || *st == ST_END_SELECT || *st == ST_END_INTERFACE || *st == ST_END_FORALL - || *st == ST_END_WHERE) + || *st == ST_END_WHERE + || /* A contained procedure requires END FUNCTION/SUBROUTINE. */ + ((state == COMP_FUNCTION || state == COMP_SUBROUTINE) + && gfc_state_stack->previous != NULL + && gfc_state_stack->previous->state == COMP_CONTAINS)) { gfc_error ("%s statement expected at %C", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1196f7195e9..733a53c83af 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2004-06-12 Tobias Schlueter + + PR fortran/14957 + * gfortran.fortran-torture/execute/stack_varsize.f90: Correct + syntax errors in end statements of contained subroutines. + 2004-06-12 Tobias Schlueter PR fortran/12841 diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/stack_varsize.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/stack_varsize.f90 index f839c8e36bc..6342e1a406e 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/stack_varsize.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/stack_varsize.f90 @@ -17,7 +17,7 @@ contains k = 30 if ((a .ne. 10.0).or.(b(1) .ne. 20.0).or.(c(1) .ne. 30.0)) call abort if ((m .ne. 10).or.(n(256,4) .ne. 20).or.(k(1,1024) .ne. 30)) call abort - end + end subroutine ! Local variables defined in recursive subroutine are always put on stack. recursive subroutine sub2 (n) @@ -26,5 +26,5 @@ contains if (n .ge. 1) call sub2 (n-1) if (a(1) .ne. 42) call abort a (1) = 0 - end + end subroutine end -- 2.30.2