Hi Jerry,

LGTM. Applies cleanly and passes regression testing.

OK for mainline and later for gcc-16.

Thanks

Paul

On Fri, 5 Jun 2026 at 18:36, Jerry D <[email protected]> wrote:
>
> See the attached patch.
>
> Regression tested on x86_64.
>
> I think the comments are clearer on this one. I have learned to edit out the
> verbosity.
>
> OK for mainline and later 16?
>
> Regards,
>
> Jerry
>
> ---
>
> Two issues prevented ASSOCIATE constructs whose selector is a call to a
> contained function from subsequently calling type-bound procedures on the
> associate name.
>
> When the selector is a contained function, resolving it
> at parse time (before CONTAINS is fully processed) prematurely set the
> function's attribute to FL_PROCEDURE/EXTERNAL, conflicting with its later
> declaration as an internal procedure and giving a spurious "attribute
> conflict" error.
>
> When the first access is a generic type-bound procedure name, no candidate
> type was found, and the associate name got no type, giving "no IMPLICIT type".
> Now also search type-bound procedure names via gfc_find_typebound_proc; 
> exclude
> vtable types to avoid false positives.
>
> Assisted by: Claude Sonnet 4.6
>
>         PR fortran/125530
>
> gcc/fortran/ChangeLog:
>
>         * match.cc (gfc_match_call): Route ASSOCIATE names followed by '%'
>         to match_typebound_call without first resolving the selector, to
>         avoid prematurely marking a contained-function selector as EXTERNAL.
>         * symbol.cc (find_derived_types): Also search type-bound procedure
>         names via gfc_find_typebound_proc when inferring the type of an
>         inferred-type ASSOCIATE name; exclude vtable types.
>
> gcc/testsuite/ChangeLog:
>
>         * gfortran.dg/associate_contained_func_typebound.f90: New test.
> ---

Reply via email to