https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94737
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
CC| |kargl at gcc dot gnu.org
Last reconfirmed| |2020-04-23
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Known to fail| |10.0, 8.1.0
--- Comment #1 from kargl at gcc dot gnu.org ---
This also fails with trunk as svn revision 280157. The following trivial patch
allows your code to compile.
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 280157)
+++ gcc/fortran/resolve.c (working copy)
@@ -2517,8 +2517,14 @@ resolve_global_procedure (gfc_symbol *sym, locus *wher
gsym = gfc_get_gsymbol (sym->binding_label ? sym->binding_label : sym->name,
sym->binding_label != NULL);
- if ((gsym->type != GSYM_UNKNOWN && gsym->type != type))
- gfc_global_used (gsym, where);
+ if (gsym->type != GSYM_UNKNOWN && gsym->type != type)
+ {
+ if (sym->binding_label && gsym->binding_label
+ && strcmp (sym->binding_label, gsym->binding_label) != 0)
+ ;
+ else
+ gfc_global_used (gsym, where);
+ }
if ((sym->attr.if_source == IFSRC_UNKNOWN
|| sym->attr.if_source == IFSRC_IFBODY)
Passing the created *.mod file through gunzip shows
3 'func1' 'foo' 'c_func' 1 ((PROCEDURE UNKNOWN-INTENT EXTERNAL-PROC BODY
UNKNOWN 0 0 EXTERNAL FUNCTION IS_BIND_C IS_C_INTEROP
ARRAY_OUTER_DEPENDENCY) () (INTEGER 4 0 1 0 INTEGER ()) 4 0 (5) () 6 ()
() () 0 0)
11 'sub1' 'foo' 'c_Func' 1 ((PROCEDURE UNKNOWN-INTENT MODULE-PROC BODY
UNKNOWN 0 0 EXTERNAL SUBROUTINE IS_BIND_C IS_C_INTEROP
ARRAY_OUTER_DEPENDENCY) () (UNKNOWN 0 0 1 0 UNKNOWN ()) 12 0 (13 14) ()
so I suspect it works. Probably, need to expand the test to skip the
error path to do comparisons involving sym->name and gsym->name. Just
details for someone else to consider.