diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5f94e76b0462b560aa329f76ceac560033e3785d..683d66bbf913b17fadb79b670006a76f736883ee 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2008-01-13 Tobias Burnus <burnus@net-b.de> + + PR fortran/34763 + * decl.c (contained_procedure): Only check directly preceeding state. + 2008-01-13 Tobias Burnus <burnus@net-b.de> PR fortran/34759 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index dd8eb35ae6b5e456e23522344f80cf8bffa33963..74d096267bc18c1db983e3ce1192fff8bc6a9d36 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -4870,12 +4870,11 @@ gfc_match_bind_c (gfc_symbol *sym, bool allow_binding_name) static int contained_procedure (void) { - gfc_state_data *s; + gfc_state_data *s = gfc_state_stack; - for (s=gfc_state_stack; s; s=s->previous) - if ((s->state == COMP_SUBROUTINE || s->state == COMP_FUNCTION) - && s->previous != NULL && s->previous->state == COMP_CONTAINS) - return 1; + if ((s->state == COMP_SUBROUTINE || s->state == COMP_FUNCTION) + && s->previous != NULL && s->previous->state == COMP_CONTAINS) + return 1; return 0; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 98557e6043f0207a4ba565679f22b8d5acc49679..09b233e064403a9cfccf95d1122f1db54dc7ec74 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-01-13 Tobias Burnus <burnus@net-b.de> + + PR fortran/34763 + * gfortran.dg/interface_proc_end.f90: New. + 2008-01-13 Tobias Burnus <burnus@net-b.de> PR fortran/34759 diff --git a/gcc/testsuite/gfortran.dg/interface_proc_end.f90 b/gcc/testsuite/gfortran.dg/interface_proc_end.f90 new file mode 100644 index 0000000000000000000000000000000000000000..d037de694a52358e494a275356fc20ea5734c9af --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_proc_end.f90 @@ -0,0 +1,19 @@ +! { dg-do compile} +! +! PR fortran/34763 +! Before, gfortran did not allow for the "END" in +! the interface, which is no module procedure. +! +! Test case contributed by Dick Hendrickson +! + module n + contains + subroutine n_interface + INTERFACE + SUBROUTINE NGSXDY(TLS1,TLS2) + REAL :: TLS1,TLS2 + END ! OK + END INTERFACE + end ! { dg-error "END SUBROUTINE statement" } + end module ! { dg-error "END SUBROUTINE statement" } +! { dg-excess-errors "Unexpected end of file" }