gcc/libgomp/testsuite/libgomp.c-c++-common/reduction-17.c
Jakub Jelinek 3a81735c1c openmp: Fix reduction clause handling on teams distribute simd [PR99928]
When a directive isn't combined with worksharing-loop, it takes much
simpler clause splitting path for reduction, and that one was missing
handling of teams when combined with simd.

2021-05-25  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/99928
gcc/c-family/
	* c-omp.c (c_omp_split_clauses): Copy reduction to teams when teams is
	combined with simd and not with taskloop or for.
gcc/testsuite/
	* c-c++-common/gomp/pr99928-8.c: Remove xfails from omp teams r21 and
	r28 checks.
	* c-c++-common/gomp/pr99928-9.c: Likewise.
	* c-c++-common/gomp/pr99928-10.c: Likewise.
libgomp/
	* testsuite/libgomp.c-c++-common/reduction-17.c: New test.
2021-05-25 11:07:01 +02:00

17 lines
246 B
C

/* PR middle-end/99928 */
/* { dg-do run } */
#define N 64
int
main ()
{
int r = 0, i;
#pragma omp teams distribute simd reduction(+:r)
for (i = 0; i < N; i++)
r += i;
if (r != N * (N - 1) / 2)
__builtin_abort ();
return 0;
}