]> git.ipfire.org Git - thirdparty/gcc.git/commit
openmp: Assorted depend/affinity/iterator related fixes [PR100859]
authorJakub Jelinek <jakub@redhat.com>
Thu, 3 Jun 2021 08:38:08 +0000 (10:38 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 3 Jun 2021 08:38:08 +0000 (10:38 +0200)
commit098f4e989beb1a1be1157430c56ea4f158c1d538
treec4c9a0381fea204c577e7ebbb28eeef4c5e516e4
parentbff9a7ec6e3b8bf9d9635445c94e6c166e6f43e1
openmp: Assorted depend/affinity/iterator related fixes [PR100859]

The depend-iterator-3.C testcases shows various bugs.

1) tsubst_omp_clauses didn't handle OMP_CLAUSE_AFFINITY (should be
   handled like OMP_CLAUSE_DEPEND)
2) because locators can be arbitrary lvalue expressions, we need
   to allow for C++ array section base (especially when array section
   is just an array reference) FIELD_DECLs, handle them as this->member,
   but don't need to privatize in any way
3) similarly for this as base
4) depend(inout: this) is invalid, but for different reason than the reported
   one, again this is an expression, but not lvalue expression, so that
   should be reported
5) the ctor/dtor cloning in the C++ FE (which is using walk_tree with
   copy_tree_body_r) didn't handle iterators correctly, walk_tree normally
   doesn't walk TREE_PURPOSE of TREE_LIST, and in the iterator case
   that TREE_VEC contains also a BLOCK that needs special handling during
   copy_tree_body_r

2021-06-03  Jakub Jelinek  <jakub@redhat.com>

PR c++/100859
gcc/
* tree-inline.c (copy_tree_body_r): Handle iterators on
OMP_CLAUSE_AFFINITY or OMP_CLAUSE_DEPEND.
gcc/c/
* c-typeck.c (c_finish_omp_clauses): Move OMP_CLAUSE_AFFINITY
after depend only cases.
gcc/cp/
* semantics.c (handle_omp_array_sections_1): For
OMP_CLAUSE_{AFFINITY,DEPEND} handle FIELD_DECL base using
finish_non_static_data_member and allow this as base.
(finish_omp_clauses): Move OMP_CLAUSE_AFFINITY
after depend only cases.  Let this be diagnosed by !lvalue_p
case for OMP_CLAUSE_{AFFINITY,DEPEND} and remove useless
assert.
* pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_AFFINITY.
gcc/testsuite/
* g++.dg/gomp/depend-iterator-3.C: New test.
* g++.dg/gomp/this-1.C: Don't expect any diagnostics for
this as base expression of depend array section, expect a different
error wording for this as depend locator and add testcases
for affinity clauses.
gcc/c/c-typeck.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/testsuite/g++.dg/gomp/depend-iterator-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/this-1.C
gcc/tree-inline.c