From d73e0ccf8572dd291477257904d640b6ef4afd36 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Mon, 4 Jul 2016 21:04:55 +0000 Subject: [PATCH] re PR fortran/66575 (Endless compilation on missing end interface) 2016-07-04 Jerry DeLisle PR fortran/66575 * decl.c (match_procedure_interface): Exit loop if procedure interface refers to itself. * gfortran.dg: pr65575.f90: New test. From-SVN: r237994 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/decl.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr66575.f90 | 6 ++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr66575.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 37481e566cf..f833b97bb64 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-07-04 Jerry DeLisle + + PR fortran/66575 + * decl.c (match_procedure_interface): Exit loop if procedure + interface refers to itself. + 2016-07-04 Jerry DeLisle Steven G. Kargl diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 724f14f7ff1..1b62833f62f 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -5454,7 +5454,8 @@ match_procedure_interface (gfc_symbol **proc_if) /* Resolve interface if possible. That way, attr.procedure is only set if it is declared by a later procedure-declaration-stmt, which is invalid per F08:C1216 (cf. resolve_procedure_interface). */ - while ((*proc_if)->ts.interface) + while ((*proc_if)->ts.interface + && *proc_if != (*proc_if)->ts.interface) *proc_if = (*proc_if)->ts.interface; if ((*proc_if)->attr.flavor == FL_UNKNOWN diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1c6ff51c4e8..fdd01b302bd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-04 Jerry DeLisle + + PR fortran/65575 + * gfortran.dg: pr65575.f90: New test. + 2016-07-04 Jerry DeLisle PR fortran/35849 diff --git a/gcc/testsuite/gfortran.dg/pr66575.f90 b/gcc/testsuite/gfortran.dg/pr66575.f90 new file mode 100644 index 00000000000..7a0a604ed4e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr66575.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } +! Bug 66575 - Endless compilation on missing end interface +program p + procedure(g) :: g ! { dg-error "may not be used as its own interface" } + procedure(g) ! { dg-error "Syntax error in PROCEDURE statement" } +end -- 2.30.2