| 1 | // RUN: %libomptarget-compile-run-and-check-generic |
| 2 | // FIXME: This fails with optimization enabled and prints b: 0 |
| 3 | // FIXME: RUN: %libomptarget-compileopt-run-and-check-generic |
| 4 | |
| 5 | #include <omp.h> |
| 6 | #include <stdio.h> |
| 7 | |
| 8 | int main() { |
| 9 | int b = 0; |
| 10 | |
| 11 | #pragma omp target map(tofrom : b) thread_limit(256) |
| 12 | for (int i = 1; i <= 1; ++i) { |
| 13 | #pragma omp parallel num_threads(64) reduction(+ : b) |
| 14 | #pragma omp parallel num_threads(10) reduction(+ : b) |
| 15 | #pragma omp for |
| 16 | for (int k = 0; k < 10; ++k) |
| 17 | ++b; |
| 18 | } |
| 19 | |
| 20 | // CHECK: b: 640 |
| 21 | printf(format: "b: %i\n" , b); |
| 22 | return 0; |
| 23 | } |
| 24 | |