https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82943
--- Comment #6 from janus at gcc dot gnu.org --- Actually the patch is better expressed as: diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index a2beb7fc90a..4710b7d2975 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -13433,8 +13433,9 @@ resolve_typebound_procedure (gfc_symtree* stree) goto error; } - if (CLASS_DATA (me_arg)->ts.u.derived - != resolve_bindings_derived) + if ((CLASS_DATA (me_arg)->ts.u.derived != resolve_bindings_derived) && + !(resolve_bindings_derived->attr.pdt_template + && CLASS_DATA (me_arg)->ts.u.derived->attr.pdt_type)) { gfc_error ("Argument %qs of %qs with PASS(%s) at %L must be of" " the derived-type %qs", me_arg->name, proc->name, But one still needs to make sure that the PDT template and the PDT type actually belong to each other and enforce another condition: "All length type parameters of the passed object dummy argument must be assumed." (as ifort puts it)