diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-05-02 12:44:55 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2006-05-02 12:44:55 +0200 |
commit | 077b0dfbfe62790f11c2d173da10b80ed752f9d1 (patch) | |
tree | e7fe929b16a97446edb70447a1000494b145b0dd /gcc/gimplify.c | |
parent | 2aee3e57aed77de4f5ef28a8711b315aeb1bf77c (diff) | |
download | gcc-077b0dfbfe62790f11c2d173da10b80ed752f9d1.zip gcc-077b0dfbfe62790f11c2d173da10b80ed752f9d1.tar.gz gcc-077b0dfbfe62790f11c2d173da10b80ed752f9d1.tar.bz2 |
re PR middle-end/27337 (OpenMP ICE in expand_expr_real_1 at expr.c:6814)
PR middle-end/27337
* gimplify.c (gimplify_scan_omp_clauses): Handle INDIRECT_REF
around RESULT_DECL for result passed by reference.
(gimplify_expr): Call omp_notice_variable when RESULT_DECL is seen.
* omp-low.c (use_pointer_for_field): Don't look at
DECL_HAS_VALUE_EXPR_P for RESULT_DECLs.
(scan_omp_1): Call remap_decl on RESULT_DECLs.
(lower_rec_input_clauses): Don't allocate VLA memory for the second
time or var for passing by reference for
OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE clauses. Allow creation of
TREE_ADDRESSABLE variables when passing by reference.
* omp-low.c (dump_omp_region): Fix output formatting.
cp/
* cp-gimplify.c (cxx_omp_privatize_by_reference): New function.
* cp-tree.h (cxx_omp_privatize_by_reference): New prototype.
* cp-objcp-common.h (LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Define.
testsuite/
* g++.dg/gomp/pr27337-1.C: New test.
* g++.dg/gomp/pr27337-2.C: New test.
libgomp/
* testsuite/libgomp.c++/pr27337.C: New test.
From-SVN: r113456
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 3ee21d8..af3d924 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4504,6 +4504,11 @@ gimplify_scan_omp_clauses (tree *list_p, tree *pre_p, bool in_parallel) remove = true; break; } + /* Handle NRV results passed by reference. */ + if (TREE_CODE (decl) == INDIRECT_REF + && TREE_CODE (TREE_OPERAND (decl, 0)) == RESULT_DECL + && DECL_BY_REFERENCE (TREE_OPERAND (decl, 0))) + OMP_CLAUSE_DECL (c) = decl = TREE_OPERAND (decl, 0); omp_add_variable (ctx, decl, flags); if (TREE_CODE (c) == OMP_CLAUSE_REDUCTION && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)) @@ -4531,6 +4536,11 @@ gimplify_scan_omp_clauses (tree *list_p, tree *pre_p, bool in_parallel) remove = true; break; } + /* Handle NRV results passed by reference. */ + if (TREE_CODE (decl) == INDIRECT_REF + && TREE_CODE (TREE_OPERAND (decl, 0)) == RESULT_DECL + && DECL_BY_REFERENCE (TREE_OPERAND (decl, 0))) + OMP_CLAUSE_DECL (c) = decl = TREE_OPERAND (decl, 0); do_notice: if (outer_ctx) omp_notice_variable (outer_ctx, decl, true); @@ -5558,6 +5568,13 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ret = gimplify_var_or_parm_decl (expr_p); break; + case RESULT_DECL: + /* When within an OpenMP context, notice uses of variables. */ + if (gimplify_omp_ctxp) + omp_notice_variable (gimplify_omp_ctxp, *expr_p, true); + ret = GS_ALL_DONE; + break; + case SSA_NAME: /* Allow callbacks into the gimplifier during optimization. */ ret = GS_ALL_DONE; |