https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98383
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:03fd9caa6a2515aafe9edda3c5325b5e4e039bde commit r10-9222-g03fd9caa6a2515aafe9edda3c5325b5e4e039bde Author: Jakub Jelinek <ja...@redhat.com> Date: Mon Dec 21 08:59:05 2020 +0100 openmp: Fix up handling of addressable temporaries in simd lb, b and incr expressions [PR98383] For simd, we have code to artificially add locally defined variables into private clauses if they are addressable, so that omplower turns them into "omp simd array" variables. As the testcase shows, this is undesirable if those temporaries only show in the lb, b or incr expressions and nowhere else, if it is just used there, we really want normal scalar temporaries. This patch implements that by making sure we don't set for those GOVD_LOCAL-ish temporaries turned into GOVD_PRIVATE the GOVD_SEEN flag during gimplification of the lb, b and incr expressions, which means that the private clause isn't added for those. 2020-12-21 Jakub Jelinek <ja...@redhat.com> PR c++/98383 * gimplify.c (struct gimplify_omp_ctx): Add in_for_exprs flag. (gimple_add_tmp_var): For addressable temporaries appearing in simd lb, b or incr expressions, don't add a private clause unless it is seen also outside of those expressions in the simd body. (omp_notice_variable): Likewise. (gimplify_omp_for): Set and reset in_for_exprs around gimplification of lb, b or incr expressions. * g++.dg/gomp/pr98383.C: New test. (cherry picked from commit b6237343e78ae115d09618efc1443bdf2fd6c09b)