]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix up detach clause vs. data-sharing clause checking [PR100319]
authorJakub Jelinek <jakub@redhat.com>
Thu, 29 Apr 2021 09:11:37 +0000 (11:11 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 29 Apr 2021 09:11:37 +0000 (11:11 +0200)
commit1b462deabf70e0f4bebb1f85118827d9c2eeffb5
treeebf9101771dff41bf9e4782ded4a8fc67a198797
parentc57a8aea0c3ab8394f7dbfa417ee27b4613f63b7
c++: Fix up detach clause vs. data-sharing clause checking [PR100319]

The standard says that "The event-handle will be considered as if it
was specified on a firstprivate clause." which means that it can't
be explicitly specified in some other data-sharing clause.
The checking is implemented correctly for C, but for C++ when detach_seen
is true (i.e. the construct had detach clause) we were comparing
OMP_CLAUSE_DECL (c) with t, which was previously initialized to
OMP_CLAUSE_DECL (c), which means it complained about any explicit
data-sharing clause on the same construct with a detach clause.

Fixed by remembering the detach clause in detach_seen (instead of a boolean
flag) and comparing against its OMP_CLAUSE_DECL.

2021-04-29  Jakub Jelinek  <jakub@redhat.com>

PR c++/100319
* semantics.c (finish_omp_clauses): Fix up check that variable
mentioned in detach clause doesn't appear in data-sharing clauses.

* c-c++-common/gomp/task-detach-3.c: New test.
gcc/cp/semantics.c
gcc/testsuite/c-c++-common/gomp/task-detach-3.c [new file with mode: 0644]