1 // RUN: %libomptarget-compilexx-and-run-generic
2 // RUN: %libomptarget-compileoptxx-and-run-generic
8 int main(int argc
, char *argv
[]) {
10 std::cout
<< "outside a = " << a
<< " addr " << &a
<< std::endl
;
11 #pragma omp target map(tofrom : a) depend(out : a) nowait
14 for (int i
= 0; i
< 100000; i
++)
19 #pragma omp task depend(inout : a) shared(a)
21 std::cout
<< "a = " << a
<< " addr " << &a
<< std::endl
;
23 throw std::runtime_error("wrong result!");
27 #pragma omp task depend(inout : a) shared(a)
29 std::cout
<< "a = " << a
<< " addr " << &a
<< std::endl
;
31 throw std::runtime_error("wrong result!");
37 assert(a
== 3 && "wrong result!");