[flang][cuda] Do not register global constants (#118582)
[llvm-project.git] / openmp / runtime / test / tasking / issue-87307.c
blobf889ae20329eb31940fec09d9f1bd5af75490caf
1 // RUN: %libomp-compile-and-run
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <omp.h>
6 int a;
8 void inc_a() {
9 #pragma omp task
11 #pragma omp atomic
12 a++;
16 int main() {
17 int n;
18 int nth_outer;
19 omp_set_max_active_levels(2);
20 omp_set_dynamic(0);
22 for (n = 0; n < 200; ++n) {
23 a = 0;
24 #pragma omp parallel num_threads(8)
26 if (omp_get_thread_num() == 0)
27 nth_outer = omp_get_num_threads();
28 #pragma omp parallel num_threads(2)
30 int i;
31 #pragma omp master
32 for (i = 0; i < 50; ++i)
33 inc_a();
36 if (a != nth_outer * 50) {
37 fprintf(stderr, "error: a (%d) != %d\n", a, nth_outer * 50);
38 return EXIT_FAILURE;
42 return EXIT_SUCCESS;