aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-09-29 10:17:52 +0200
committerJakub Jelinek <jakub@redhat.com>2021-09-29 10:17:52 +0200
commitd3e7bb15e28c554bf4484a912f3b9c18c60ec68f (patch)
treeacd316deacea106ab416e5a17d9f58802371f11a /gcc/gimplify.c
parentc6dbe7a56dfb511101ddea98844a7be0027d30a6 (diff)
downloadgcc-d3e7bb15e28c554bf4484a912f3b9c18c60ec68f.zip
gcc-d3e7bb15e28c554bf4484a912f3b9c18c60ec68f.tar.gz
gcc-d3e7bb15e28c554bf4484a912f3b9c18c60ec68f.tar.bz2
openmp: Disallow reduction with var private in containing parallel even on scope [PR102504]
The standard has a restriction: "A list item that appears in a reduction clause of a scope construct must be shared in the parallel region to which a corresponding scope region binds." similar to the restriction for worksharing constructs, but we were checking it only on worksharing constructs and not for scope and ICEd later on during omp expansion. 2021-09-29 Jakub Jelinek <jakub@redhat.com> PR middle-end/102504 * gimplify.c (gimplify_scan_omp_clauses): Use omp_check_private even in OMP_SCOPE clauses, not just on worksharing construct clauses. * c-c++-common/gomp/scope-4.c: New test.
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 1067113..f4bc649 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -10195,7 +10195,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
if (outer_ctx)
omp_notice_variable (outer_ctx, decl, true);
if (check_non_private
- && region_type == ORT_WORKSHARE
+ && (region_type == ORT_WORKSHARE || code == OMP_SCOPE)
&& (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_REDUCTION
|| decl == OMP_CLAUSE_DECL (c)
|| (TREE_CODE (OMP_CLAUSE_DECL (c)) == MEM_REF