diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-06-23 10:03:28 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-06-23 10:03:28 +0200 |
commit | 679506c3830ea1a93c755413609bfac3538e2cbd (patch) | |
tree | de36e1544d965068d0698fa2c494089c508e692b /gcc/omp-low.c | |
parent | c2124b51a9b83c76400ebb1862b26f61410e77db (diff) | |
download | gcc-679506c3830ea1a93c755413609bfac3538e2cbd.zip gcc-679506c3830ea1a93c755413609bfac3538e2cbd.tar.gz gcc-679506c3830ea1a93c755413609bfac3538e2cbd.tar.bz2 |
openmp: Fix up *_reduction clause handling with UDRs on PARM_DECLs [PR101167]
The following testcase FAILs, because the UDR combiner is invoked incorrectly.
lower_omp_rec_clauses expects that when it sets
DECL_VALUE_EXPR/DECL_HAS_VALUE_EXPR_P
for both the placeholder and the var that everything will be properly
regimplified, but as the variable in question is a PARM_DECL rather than
VAR_DECL, lower_omp_regimplify_p doesn't say that it should be regimplified
and so it is not.
2021-06-23 Jakub Jelinek <jakub@redhat.com>
PR middle-end/101167
* omp-low.c (lower_omp_regimplify_p): Regimplify also PARM_DECLs
and RESULT_DECLs that have DECL_HAS_VALUE_EXPR_P set.
* testsuite/libgomp.c-c++-common/task-reduction-15.c: New test.
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 2cc2a18..6c1d6b3 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -13539,7 +13539,9 @@ lower_omp_regimplify_p (tree *tp, int *walk_subtrees, tree t = *tp; /* Any variable with DECL_VALUE_EXPR needs to be regimplified. */ - if (VAR_P (t) && data == NULL && DECL_HAS_VALUE_EXPR_P (t)) + if ((VAR_P (t) || TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL) + && data == NULL + && DECL_HAS_VALUE_EXPR_P (t)) return t; if (task_shared_vars |