From: Jakub Jelinek Date: Thu, 6 Feb 2020 08:15:13 +0000 (+0100) Subject: openmp: Notice reduction decl in outer contexts after adding it to shared [PR93515] X-Git-Tag: releases/gcc-9.3.0~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3266b1311723841ec553277f1fb6bfddef8809d;p=thirdparty%2Fgcc.git openmp: Notice reduction decl in outer contexts after adding it to shared [PR93515] If we call omp_add_variable, following omp_notice_variable will already find it on that construct and not go through outer constructs, the following patch fixes that. Note, this still doesn't follow OpenMP 5.0 semantics on target combined with other constructs with reduction/lastprivate/linear clauses, will handle that for GCC11. 2020-02-06 Jakub Jelinek PR libgomp/93515 * gimplify.c (gimplify_scan_omp_clauses) : If adding shared clause, call omp_notice_variable on outer context if any. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4435086f023..bc199e5956f4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2020-02-13 Jakub Jelinek Backported from mainline + 2020-02-06 Jakub Jelinek + + PR libgomp/93515 + * gimplify.c (gimplify_scan_omp_clauses) : If adding + shared clause, call omp_notice_variable on outer context if any. + 2020-02-05 Jakub Jelinek PR middle-end/93555 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index a0cb6c402bcf..c57113cda1db 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -9081,9 +9081,13 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, == POINTER_TYPE)))) omp_firstprivatize_variable (outer_ctx, decl); else - omp_add_variable (outer_ctx, decl, - GOVD_SEEN | GOVD_SHARED); - omp_notice_variable (outer_ctx, decl, true); + { + omp_add_variable (outer_ctx, decl, + GOVD_SEEN | GOVD_SHARED); + if (outer_ctx->outer_context) + omp_notice_variable (outer_ctx->outer_context, decl, + true); + } } } if (outer_ctx)