]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenACC: whole struct vs. component mappings (PR107028)
authorJulian Brown <julian@codesourcery.com>
Tue, 27 Sep 2022 17:39:59 +0000 (17:39 +0000)
committerJulian Brown <julian@codesourcery.com>
Thu, 29 Sep 2022 13:53:27 +0000 (13:53 +0000)
commit8ace67ddb97698709a622b2f8ba2718524aa5eeb
tree863dc9626b2e252a660f1d00a0256aa1ca0bac0f
parent9ca147154074a0de548138b4e73477e94903a855
OpenACC: whole struct vs. component mappings (PR107028)

This patch fixes an ICE when both a complete struct variable and
components of that struct are mapped on the same directive for OpenACC,
using a modified version of the scheme used for OpenMP in the following
patch:

  https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601558.html

A new function has been added to make sure that the mapping kinds of
the whole struct and the member access are compatible -- conservatively,
so as not to copy more to/from the device than the user expects.

This version of the patch uses a different method to detect duplicate
clauses for OpenACC in oacc_resolve_clause_dependencies, and removes
the now-redundant check in omp_accumulate_sibling_lists.  (The latter
check would no longer trigger when we map the whole struct on the same
directive because the component-mapping clauses are now deleted before
the check is executed.)

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

gcc/
PR middle-end/107028
* gimplify.cc (omp_check_mapping_compatibility,
oacc_resolve_clause_dependencies): New functions.
(omp_accumulate_sibling_list): Remove redundant duplicate clause
detection for OpenACC.
(build_struct_sibling_lists): Skip deleted groups.  Don't build sibling
list for struct variables that are fully mapped on the same directive
for OpenACC.
(gimplify_scan_omp_clauses): Call oacc_resolve_clause_dependencies.

gcc/testsuite/
PR middle-end/107028
* c-c++-common/goacc/struct-component-kind-1.c: New test.
* g++.dg/goacc/pr107028-1.C: New test.
* g++.dg/goacc/pr107028-2.C: New test.
* gfortran.dg/goacc/mapping-tests-5.f90: New test.
gcc/gimplify.cc
gcc/testsuite/c-c++-common/goacc/struct-component-kind-1.c [new file with mode: 0644]
gcc/testsuite/g++.dg/goacc/pr107028-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/goacc/pr107028-2.C [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/mapping-tests-5.f90 [new file with mode: 0644]