OpenMP: Push attaches to end of clause list in "target" regions
authorJulian Brown <julian@codesourcery.com>
Wed, 7 Sep 2022 21:45:07 +0000 (21:45 +0000)
committerJulian Brown <julian@codesourcery.com>
Sun, 18 Sep 2022 19:53:19 +0000 (19:53 +0000)
commit313879d8768d08dea035efd7fd62b753dc91c364
treef9df85fd73efabccf504cae13c05c944bb09f8c3
parentd458f806afe07d1e06bdf275e94d05a716f41bf6
OpenMP: Push attaches to end of clause list in "target" regions

This patch moves GOMP_MAP_ATTACH{_ZERO_LENGTH_ARRAY_SECTION} nodes to
the end of the clause list, for offload regions.  This ensures that when
we do the attach operation, both the "attachment point" and the target
region have both already been mapped on the target.  This avoids a
pathological case that can otherwise happen with struct sibling-list
handling.

This version of the patch moves the attach-node motion to
gimplify_adjust_omp_clauses.

2022-09-15  Julian Brown  <julian@codesourcery.com>

gcc/
* gimplify.cc (omp_segregate_mapping_groups): Update comment.
(gimplify_adjust_omp_clauses): Move ATTACH and
ATTACH_ZERO_LENGTH_ARRAY_SECTION nodes to the end of the clause list
for offloaded OpenMP regions.

gcc/testsuite/
* g++.dg/gomp/target-lambda-1.C: Adjust expected scan output.
gcc/gimplify.cc
gcc/testsuite/g++.dg/gomp/target-lambda-1.C