aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-11-13 18:57:06 +0100
committerJakub Jelinek <jakub@redhat.com>2020-11-13 18:57:06 +0100
commit67100cb50ea22e1fc855360b887959f874fafe2c (patch)
tree8ef9baeb007dcce1c7d132966f7d819e6ce2ab72 /gcc/c
parent2e97d6443f0a862ce9b798084499635914e3b8c6 (diff)
downloadgcc-67100cb50ea22e1fc855360b887959f874fafe2c.zip
gcc-67100cb50ea22e1fc855360b887959f874fafe2c.tar.gz
gcc-67100cb50ea22e1fc855360b887959f874fafe2c.tar.bz2
openmp: Support allocate for C/C++ array section reductions
This adds allocate clause support for array section reductions. Furthermore, it fixes one bug that would cause inscan reductions with allocate to be rejected by C, and for now just ignores allocate for inscan/task reductions, that will need slightly more work. 2020-11-13 Jakub Jelinek <jakub@redhat.com> gcc/ * omp-low.c (scan_sharing_clauses): For now remove for reduction clauses with inscan or task modifiers decl from allocate_map. (lower_private_allocate): Handle TYPE_P (new_var). (lower_rec_input_clauses): Handle allocate clause for C/C++ array reductions. gcc/c/ * c-typeck.c (c_finish_omp_clauses): Don't clear OMP_CLAUSE_REDUCTION_INSCAN unless reduction_seen == -2. libgomp/ * testsuite/libgomp.c-c++-common/allocate-1.c (foo): Add tests for array reductions. (main): Adjust foo callers.
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/c-typeck.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index df1dad4..26a5f71 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -15199,7 +15199,8 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
OMP_CLAUSE_LINEAR_STEP (c));
remove = true;
}
- else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION)
+ else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
+ && reduction_seen == -2)
OMP_CLAUSE_REDUCTION_INSCAN (c) = 0;
if (remove)