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

--- Comment #15 from Bernhard Reutner-Fischer <aldot at gcc dot gnu.org> ---
(In reply to Bernhard Reutner-Fischer from comment #13)

> I'm testing a patch.

I have to admit that this is a mess.

It's even more frustrating now as i did some preparatory cleanup for at least
some of the inconveniences in that area a while ago but never got to apply
these. Anyway.

Not sure if the following would be correct:

Under the assumption that we have a generic "c_ptr" in a module, we know (?)
that "c_ptr" is not ambiguous.

Is that right?

>From what i see from a quick glance, we seem to write more symbols to the
module files than strictly needed, and that does not really help the case.

Short of a broader fix, a quick-hack to avoid the error about ambiguous
intrinsic built-in symbols might be to (*cough*):

--- a/gcc/fortran/module.cc
+++ b/gcc/fortran/module.cc
@@ -5320,6 +5322,11 @@ check_for_ambiguous (gfc_symtree *st, pointer_info
*info)
        return false;
     }

+  /* A symbol from an intrinsic module is not ambiguous.  */
+  /* This should not be necessary, at least not in this form!  */
+  if (st_sym->from_intmod != INTMOD_NONE)
+    return false;
+
   return true;
 }


This works as expected, fixes this specific PR and tests cleanly.
Should i propose this workaround as a patch or is it a bit too gross?
WDYT?

Reply via email to