Re: [Patch, fortran] PR126205 - A coarray allocated in a team is not being automatically deallocated

Jerry DeLisle <[email protected]> Sat, 1 Aug 2026 08:50:09 -0700
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>

On 7/31/26 9:51 AM, Paul Richard Thomas wrote:
> Hello All,
> 
> I pushed the patch as submitted because it applies equally well to all
> three library models.
> 
> The auto-deallocation intrinsic to the library does not work. I have
> attached a patch for single.c and shmem.c that fixes the problem and
> pr126205. I haven't as yet looked at what happens with Open Coarrays
> and would appreciate it if somebody would give it a whirl.

I am out of town this weekend. I can run through opencoarrays Monday if 
noone else beats me to it.>
> Regards
> 
> Paul
> 
> On Fri, 24 Jul 2026 at 16:18, Paul Richard Thomas
> <[email protected]> wrote:
>>
>> Hello All,
>>  From John Reid's "Summary_of_Fortran_2018":
>>
>> 3.5 Coarrays allocated in teams
>>
>> ....snip....
>>
>> In Fortran 2018, synchronization is now across the team, of course. Symmetric memory is maintained within teams by requiring that
>>
>> 1. any allocatable coarray that is allocated before entry to a change team construct remains allocated during the execution of the construct and
>> 2. any allocatable coarray that becomes allocated within a change team construct and is still allocated when the construct is left is automatically deallocated, even if it has the save attribute.
>>
>> ....more snips....
>>
>> Requirement 2 is not yet implemented in gfortran. The attachment does the job.
>>
>> Regression tested on FC44/x86_64 - OK for mainline and eventual backporting to 16-branch?
>>
>> Paul
>>