Re: PATCH] Fortran: fix stack overflow passing assumed-rank type to, assumed-rank class [PR60576]

Jerry D <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
Paul, take the refactor off your list of TODOs. Its done.

Regression tested before the push.

The master branch has been updated by Jerry DeLisle <[email protected]>:

https://gcc.gnu.org/g:04c3c1b5b2391e33c460d45d22cfa046121c0361

commit r17-1377-g04c3c1b5b2391e33c460d45d22cfa046121c0361
Author: Jerry DeLisle <[email protected]>
Date:   Fri Jun 5 09:22:55 2026 -0700

     fortran: Refactor the commit for 60576

             PR fortran/60576

     gcc/fortran/ChangeLog:

             * trans-array.cc (gfc_resize_assumed_rank_dim_field): New
             function extracted from gfc_conv_array_parameter.
             (gfc_conv_array_parameter): Use the new function.

On 6/5/26 6:49 AM, Paul Richard Thomas wrote:
> Hi Jerry,
> 
> I am not sure that I understand why my suggested patch "threw Claude
> into a tizzy", The two chunks that you pushed are identical. My
> version turned one into a function in trans-array.cc, provided a
> prototype and called it from trans-expr.cc, thereby halving the size
> of the patch.
> 
> I have learned now that you really have to take a close look at
> Claude-generated patches. They tend to code and comment bloat. Also,
> take care with respect to pointers to the standard. It seems to
> generate them at random.
> 
> Refactoring your patch is on my todo list and I will apply it after
> you backport.
> 
> Regards
> 
> Paul
> 
> On Thu, 4 Jun 2026 at 20:52, Jerry D <[email protected]> wrote:
>>
>> On 6/3/26 11:54 PM, Paul Richard Thomas wrote:
>>> Hello Jerry,
>>>
>>> Contrary to my remark on Mattermost, this looks good to me except that
>>> I would halve the size of the patch by refactoring it as in the
>>> attached version. It passes regression testing like the original.
>>>
>>> OK for mainline and backporting later on.
>>>
>>> Thanks for re-examining this Golden Oldie!
>>>
>>> Paul
>>
>> Paul, the diff you attached threw claude into a tizzy. I slapped it and set it
>> back on track. The attached fixes the breakage in the original
>> assumed_rank_7.f90 with -fsanitize=address, passes the new
>> asan/assumed_rank_26.f90 and fixed a breakage in coarray/dummy_3.f90.
>>
>> I have completely regression tested this one and manually tested the original
>> assume_rank_7.f90 with -fsanitize=address. All pass.
>>
>> I plan to commit this shortly.
>>
>> Regards,
>>
>> Jerry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.