[PATCH 1/2] OpenMP/Fortran: Map intermediate array descriptor [PR120505]

Paul-Antoine Arras parras@baylibre.com
Thu Feb 19 13:25:23 GMT 2026


Hi Tobias,

Here is a revised version of the patch.

On 17/02/2026 11:57, Tobias Burnus wrote:
> Hi PA,
> 
> Paul-Antoine Arras wrote:
>> Initially I crafted this patch for the "simple" case with only one 
>> intermediate descriptor, leaving the more complex cases for later -- 
>> and kind of forgot about it.
> 
> I have another variant – see attachment – which also gives an ICE,
> but this time for:
> 
> 10971         node = OMP_CLAUSE_CHAIN (node);
> 10972         if (node && omp_map_clause_descriptor_p (node))
> 10973           {
> 10974             gcc_assert (node != grp->grp_end);
> 10975             node = OMP_CLAUSE_CHAIN (node);
> 10976           }
> 
> as the node == grp->grp_end.

This is now fixed and the testcase included (map-subarray-15.f90).

> * * *
> 
>>
>> To support additional layers in the FE would probably mean saving in a 
>> vector all allocatables found while walking the chain of references. 
>> Then loop through the vector and call gfc_map_array_descriptor for 
>> each element. Hopefully that will just work with no changes in the ME.
>>
>> If so, I'll come up with a revised version of the patch.
> 
> Fingers crossed!
> 

Multiple levels of nested allocatable components are now supported as 
well and the relevant testcase included (map-subarray-14.f90).
There is still one specific case that is not handled properly (no 
regression though) as demonstrated by another test 
(map-subarray-16.f90): mapping both a subcomponent and the parent struct 
on the same target directive.

This revised patch also incorporates a few formatting fixes.

Thanks,
-- 
PA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-OpenMP-Fortran-Map-intermediate-array-descriptors-PR.patch
Type: text/x-patch
Size: 39710 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20260219/8c7f81ab/attachment-0001.bin>


More information about the Fortran mailing list