Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / offloading / bug49779.cpp
blobd036f95b3c3532b655142685c7aa433ee9bbc712
1 // RUN: %libomptarget-compilexx-generic && \
2 // RUN: env LIBOMPTARGET_STACK_SIZE=2048 %libomptarget-run-generic
3 // RUN: %libomptarget-compileoptxx-generic && \
4 // RUN: env LIBOMPTARGET_STACK_SIZE=2048 %libomptarget-run-generic
6 // We need malloc/global_alloc support
7 // UNSUPPORTED: amdgcn-amd-amdhsa
9 #include <cassert>
10 #include <iostream>
12 void work(int *C) {
13 #pragma omp atomic
14 ++(*C);
17 void use(int *C) {
18 #pragma omp parallel num_threads(2)
19 work(C);
22 int main() {
23 int C = 0;
24 #pragma omp target map(C)
26 use(&C);
27 #pragma omp parallel num_threads(2)
28 use(&C);
31 assert(C >= 2 && C <= 6);
33 std::cout << "PASS\n";
35 return 0;
38 // CHECK: PASS