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

--- Comment #13 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to kargls from comment #12)
> (In reply to Damian Rouson from comment #10)
> > Steve, I changed the title based on your suggestion.  If I still missed the
> > mark, please feel free to change it again.
> > 
> > If I recall correctly, I was originally using something like '1.5_k' and one
> > compiler was accepting it but another compiler wasn't so the developer of
> > the rejecting compiler pointed out that my original choice was invalid and
> > suggested the 'real' intrinsic as a valid alternative.
> 
> Thanks for the follow-up (especially given that you were
> busy last week with J3 business).  I think Paul changed

Seconded!

This new wrinkle turns out to be caused by a change in the order in which the
specific procedure is presented to the generic interface by the pdt_type and
the pdt_template. Changing the chunk in resolve.cc thusly fixes the problem:

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 1c49ccf4711..c2c074fbbba 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -16077,10 +16077,14 @@ resolve_typebound_intrinsic_op (gfc_symbol* derived,
gfc_intrinsic_op op,

          /* Preempt 'gfc_check_new_interface' for submodules, where the
             mechanism for handling module procedures winds up resolving
-            operator interfaces twice and would otherwise cause an error.  */
+            operator interfaces twice and would otherwise cause an error.
+            Likewise, new instances of PDTs can cause the operator inter-
+            faces to be resolved multiple times.  */
          for (intr = derived->ns->op[op]; intr; intr = intr->next)
            if (intr->sym == target_proc
-               && target_proc->attr.used_in_submodule)
+               && (target_proc->attr.used_in_submodule
+                   || derived->attr.pdt_template
+                   || derived->attr.pdt_type))
              return true;

          if (!gfc_check_new_interface (derived->ns->op[op],

This is the version that I will push in a few minutes time.

Paul

Reply via email to