re PR fortran/66575 (Endless compilation on missing end interface)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Mon, 4 Jul 2016 21:04:55 +0000 (21:04 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Mon, 4 Jul 2016 21:04:55 +0000 (21:04 +0000)
2016-07-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

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
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr66575.f90 [new file with mode: 0644]

index 37481e566cfb56b4dca8d5ce62b55bfeac25f4db..f833b97bb642f1d96f0a39ca2315474308bbcb34 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/66575
+       * decl.c (match_procedure_interface): Exit loop if procedure
+       interface refers to itself.
+
 2016-07-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
            Steven G. Kargl  <kargl@gcc.gnu.org>
 
index 724f14f7ff12a248e509299c31b6b9937193bcbe..1b62833f62fcf2f95f2bb6d934e9fe27bcc0eeba 100644 (file)
@@ -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
index 1c6ff51c4e8b33f6d371a9ae5e4e744424dc6c24..fdd01b302bd3ab052f731d61a54b8355d83e2bd5 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/65575
+       * gfortran.dg: pr65575.f90: New test.
+
 2016-07-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/35849
diff --git a/gcc/testsuite/gfortran.dg/pr66575.f90 b/gcc/testsuite/gfortran.dg/pr66575.f90
new file mode 100644 (file)
index 0000000..7a0a604
--- /dev/null
@@ -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