1// RUN: %libomptarget-compile-generic -O1 && %libomptarget-run-generic
2// -O1 to run openmp-opt
3// RUN: %libomptarget-compileopt-generic -O1 && %libomptarget-run-generic
4
5int main(void) {
6 long int aa = 0;
7
8 int ng = 12;
9 int nxyz = 5;
10
11 const long exp = ng * nxyz;
12
13#pragma omp target map(tofrom : aa)
14 for (int gid = 0; gid < nxyz; gid++) {
15#pragma omp parallel for
16 for (unsigned int g = 0; g < ng; g++) {
17#pragma omp atomic
18 aa += 1;
19 }
20 }
21 if (aa != exp) {
22 return 1;
23 }
24 return 0;
25}
26

source code of offload/test/offloading/bug51982.c