This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/42418] PROCEDURE: Rejects interface which is both specific and generic procedure
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 21 Jul 2012 09:51:57 +0000
- Subject: [Bug fortran/42418] PROCEDURE: Rejects interface which is both specific and generic procedure
- Auto-submitted: auto-generated
- References: <bug-42418-4@http.gcc.gnu.org/bugzilla/>
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