http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42418

--- Comment #6 from janus at gcc dot gnu.org 2012-07-21 09:51:57 UTC ---
The error in comment #0 should be fixable by something like the following:


Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c    (revision 189711)
+++ gcc/fortran/decl.c    (working copy)
@@ -4807,9 +4807,17 @@ match_procedure_interface (gfc_symbol **proc_if)

       if ((*proc_if)->generic)
     {
-      gfc_error ("Interface '%s' at %C may not be generic",
-             (*proc_if)->name);
-      return MATCH_ERROR;
+      /* For generic interfaces, check if there is
+         a specific procedure with the same name.  */
+      gfc_interface *gen = (*proc_if)->generic;
+      while (gen && strcmp (gen->sym->name, (*proc_if)->name) != 0)
+        gen = gen->next;
+      if (!gen)
+        {
+          gfc_error ("Interface '%s' at %C may not be generic",
+              (*proc_if)->name);
+          return MATCH_ERROR;
+        }
     }
       if ((*proc_if)->attr.proc == PROC_ST_FUNCTION)
     {


However, I wonder whether this whole generic check does not come to early. If
the generic interface is declared after the PROCEDURE statement, it will not be
triggered. It should probably be moved to resolve.c

Reply via email to