PR rtl-optimization/81424
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / pr70688.c
blobf9556e34a46ae7e0546d2e5bdcc74e18d8fe6216
1 /* Verify that reduction variables can appear in data clause. */
3 #include <assert.h>
5 const int n = 100;
7 int
8 main ()
10 int s = 0;
11 int array[n];
13 for (int i = 0; i < n; i++)
14 array[i] = i+1;
16 #pragma acc parallel loop num_gangs (10) copy (s) reduction (+:s)
17 for (int i = 0; i < n; i++)
18 s += array[i];
20 #pragma acc parallel loop num_gangs (10) reduction (+:s) copy (s)
21 for (int i = 0; i < n; i++)
22 s += array[i];
24 assert (s == n * (n + 1));
26 return 0;