aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-01-05 11:57:30 +0100
committerJakub Jelinek <jakub@redhat.com>2023-01-05 11:57:30 +0100
commit29c3218618ef6177dc33871b26c8fbd9b21eabe1 (patch)
tree0affb30a38270beec5af10756d87bc83e047db90 /gcc
parent72ce780a497eb3e5efe7a79ea5f21f8dd6858f7f (diff)
downloadgcc-29c3218618ef6177dc33871b26c8fbd9b21eabe1.zip
gcc-29c3218618ef6177dc33871b26c8fbd9b21eabe1.tar.gz
gcc-29c3218618ef6177dc33871b26c8fbd9b21eabe1.tar.bz2
openmp: Fix up finish_omp_target_clauses [PR108286]
The comment in the loop says that we shouldn't add a map clause if such a clause exists already, but the loop was actually using OMP_CLAUSE_DECL on any clause. Target construct can have various clauses which don't have OMP_CLAUSE_DECL at all (e.g. nowait, device or if) or clause where it means something different (e.g. privatization clauses, allocate, depend). So, only check OMP_CLAUSE_DECL on OMP_CLAUSE_MAP clauses. 2023-01-05 Jakub Jelinek <jakub@redhat.com> PR c++/108286 * semantics.cc (finish_omp_target_clauses): Ignore clauses other than OMP_CLAUSE_MAP. * testsuite/libgomp.c++/pr108286.C: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/semantics.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index ab52e56..ef5bf24 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -9825,7 +9825,9 @@ finish_omp_target_clauses (location_t loc, tree body, tree *clauses_ptr)
for (tree c = *clauses_ptr; c; c = OMP_CLAUSE_CHAIN (c))
{
- /* If map(this->ptr[:N] already exists, avoid creating another
+ if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_MAP)
+ continue;
+ /* If map(this->ptr[:N]) already exists, avoid creating another
such map. */
tree decl = OMP_CLAUSE_DECL (c);
if ((TREE_CODE (decl) == INDIRECT_REF