7c640779bf
We'd like to actually catch compiler diagnostics (and currently there aren't any). libgomp/ * testsuite/libgomp.oacc-c-c++-common/par-reduction-1.c: Don't compile with '-w'. * testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-6.c: Likewise. * testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-7.f90: Likewise.
36 lines
482 B
C
36 lines
482 B
C
/* { dg-do run } */
|
|
|
|
/* Test reductions on explicitly private variables. */
|
|
|
|
#include <assert.h>
|
|
|
|
int
|
|
main ()
|
|
{
|
|
int i, j, red[10];
|
|
int v;
|
|
|
|
for (i = 0; i < 10; i++)
|
|
red[i] = -1;
|
|
|
|
#pragma acc parallel copyout(red)
|
|
{
|
|
#pragma acc loop gang private(v)
|
|
for (j = 0; j < 10; j++)
|
|
{
|
|
v = j;
|
|
|
|
#pragma acc loop vector reduction (+:v)
|
|
for (i = 0; i < 100; i++)
|
|
v++;
|
|
|
|
red[j] = v;
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < 10; i++)
|
|
assert (red[i] == i + 100);
|
|
|
|
return 0;
|
|
}
|