Re: [PATCH v6 04/11] openmp, fortran: Add support for map iterators in OpenMP target construct (Fortran)

Tobias Burnus <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
(CC'ed Fortran as this is about a Fortran patch, cf.
https://gcc.gnu.org/pipermail/gcc-patches/2026-June/719430.html
and https://gcc.gnu.org/pipermail/gcc-patches/2026-June/719422.html )

Sandra Loosemore wrote:

> This adds support for iterators in map clauses within OpenMP
> 'target' constructs in Fortran.
>
> Some special handling for struct field maps has been added to libgomp in
> order to handle arrays of derived types.

LGTM.

* * *

Remark - carried over from my previous email,
https://inbox.sourceware.org/gcc-patches/[email protected]/

> BTW: I was about to suggest that you shouldn't have only iterators that
> start with the base address as in 'array[0]' / 'array(lbound(array))',
> but it seems as if using 'f()' covers that case sufficiently, even if
> that still spans the whole array. - It should be well enough hidden
> such that also the other case should work

This still applies - the previous f(i,j) and current i * 4 + j + 1
in "..., to: x(i * 4 + j + 1)%arr(:))"
prevents early folding - such that the code relevant code gets
exercised even if the for i=0:..., j=0:... the lowest index
matches the lower array bound ('x(1)').

Thus, while mapping a subarray with a bit before and after unmapped
would be nicer for completeness, for the code used inside GCC and
libgomp, it should not make a difference. (Likewise for having a
dynamic array where the array bound is not known at compile time.)

* * *

Thanks for the patch work!

Tobias
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.