[Bug libgomp/106045] Incorrect testcase in libgomp.c/target-31.c at -O0

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 4 08:30:22 GMT 2022


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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:732e2315e6782bfc93241027f01cd3dfbdb5269c

commit r11-10352-g732e2315e6782bfc93241027f01cd3dfbdb5269c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jun 21 17:51:08 2022 +0200

    libgomp: Fix up target-31.c test [PR106045]

    The i variable is used inside of the parallel in:
          #pragma omp simd safelen(32) private (v)
          for (i = 0; i < 64; i++)
            {
              v = 3 * i;
              ll[i] = u1 + v * u2[0] + u2[1] + x + y[0] + y[1] + v + h[0] +
u3[i];
            }
    where i is predetermined linear (so while inside of the body
    it is safe, private per SIMD lane var) the final value is written to
    the shared variable, and in:
          for (i = 0; i < 64; i++)
            if (ll[i] != u1 + 3 * i * u2[0] + u2[1] + x + y[0] + y[1] + 3 * i +
13 + 14 + i)
              #pragma omp atomic write
                err = 1;
    which is a normal loop and so it isn't in any way privatized there.
    So we have a data race, fixed by adding private (i) clause to the
    parallel.

    2022-06-21  Jakub Jelinek  <jakub@redhat.com>
                Paul Iannetta  <piannetta@kalrayinc.com>

            PR libgomp/106045
            * testsuite/libgomp.c/target-31.c: Add private (i) clause.

    (cherry picked from commit 85d613da341b76308edea48359a5dbc7061937c4)


More information about the Gcc-bugs mailing list