Re: [PATCH] PR125530 ASSOCIATE with contained-function selector rejecting, type-bound calls

Jerry D <[email protected]> Wed, 10 Jun 2026 10:06:47 -0700
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
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



On 6/9/26 11:58 PM, Paul Richard Thomas wrote:
> 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.
>> ---