https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125530
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jerry DeLisle <[email protected]>: https://gcc.gnu.org/g:96bdfd02f4aa1ab62eb156f2ce84d0e86b2af2de commit r17-1470-g96bdfd02f4aa1ab62eb156f2ce84d0e86b2af2de Author: Jerry DeLisle <[email protected]> Date: Fri Jun 5 10:20:36 2026 -0700 fortran: ASSOCIATE with contained-function selector rejecting type-bound calls 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. * gfortran.dg/associate_contained_func_typebound_2.f90: New run-time test exercising generic resolution and a module-scope selector. (cherry picked from commit 64fee7f4475c756fc17fa9e15aee7683e716ba8a)
