From 2514265077f4260ae10377791317c6754b3292df Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 29 Jul 2011 19:45:42 +0200 Subject: re PR middle-end/49897 (nesting lastprivate gives incorrect result) PR middle-end/49897 PR middle-end/49898 * omp-low.c (use_pointer_for_field): If disallowing copy-in/out in nested parallel and outer is a gimple_reg, mark it as addressable and set its bit in task_shared_vars bitmap too. * testsuite/libgomp.c/pr49897-1.c: New test. * testsuite/libgomp.c/pr49897-2.c: New test. * testsuite/libgomp.c/pr49898-1.c: New test. * testsuite/libgomp.c/pr49898-2.c: New test. From-SVN: r176945 --- gcc/ChangeLog | 8 ++++++++ gcc/omp-low.c | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 738144d..de98034 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2011-07-29 Jakub Jelinek + + PR middle-end/49897 + PR middle-end/49898 + * omp-low.c (use_pointer_for_field): If disallowing copy-in/out + in nested parallel and outer is a gimple_reg, mark it as addressable + and set its bit in task_shared_vars bitmap too. + 2011-07-29 Uros Bizjak * config/i386/predicates.md (tp_or_register_operand): Remove predicate. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index ccd248c..0376d92 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -781,7 +781,7 @@ use_pointer_for_field (tree decl, omp_context *shared_ctx) break; if (c) - return true; + goto maybe_mark_addressable_and_ret; } } @@ -791,7 +791,9 @@ use_pointer_for_field (tree decl, omp_context *shared_ctx) returns, the task hasn't necessarily terminated. */ if (!TREE_READONLY (decl) && is_task_ctx (shared_ctx)) { - tree outer = maybe_lookup_decl_in_outer_ctx (decl, shared_ctx); + tree outer; + maybe_mark_addressable_and_ret: + outer = maybe_lookup_decl_in_outer_ctx (decl, shared_ctx); if (is_gimple_reg (outer)) { /* Taking address of OUTER in lower_send_shared_vars -- cgit v1.1