https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98383

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:b6237343e78ae115d09618efc1443bdf2fd6c09b

commit r11-6280-gb6237343e78ae115d09618efc1443bdf2fd6c09b
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.

Reply via email to