https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102818

--- Comment #1 from anlauf at gcc dot gnu.org ---
The proper function name is diagnosed after the following patch:

diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
index 7a80dfd063b..0d0221fc3c4 100644
--- a/gcc/fortran/symbol.cc
+++ b/gcc/fortran/symbol.cc
@@ -2005,7 +2005,9 @@ gfc_add_type (gfc_symbol *sym, gfc_typespec *ts, locus
*where)
        gfc_error ("Symbol %qs at %L conflicts with symbol from module %qs, "
                   "use-associated at %L", sym->name, where, sym->module,
                   &sym->declared_at);
-      else if (sym->attr.function && sym->attr.result)
+      else if ((sym->attr.function && sym->attr.result)
+              || (sym->attr.flavor == FL_PROCEDURE
+                  && sym->ns->proc_name && sym->ns->proc_name->name))
        gfc_error ("Symbol %qs at %L already has basic type of %s",
                   sym->ns->proc_name->name, where, gfc_basic_typename (type));
       else

I do not get an ICE, but valgrind suggests that error recovery is not clean.

Reply via email to