[SandboxIR][Doc] Add Quick start notes (#123992)
[llvm-project.git] / openmp / runtime / test / barrier / llvm-issue-80664.c
blob79aa228afa6be045edb2007b38131b7258b186fe
1 // RUN: %libomp-compile
2 // RUN: env OMP_WAIT_POLICY=passive \
3 // RUN: KMP_FORKJOIN_BARRIER_PATTERN='linear,linear' %libomp-run
4 // RUN: env OMP_WAIT_POLICY=passive \
5 // RUN: KMP_FORKJOIN_BARRIER_PATTERN='tree,tree' %libomp-run
6 // RUN: env OMP_WAIT_POLICY=passive \
7 // RUN: KMP_FORKJOIN_BARRIER_PATTERN='hyper,hyper' %libomp-run
8 // RUN: env OMP_WAIT_POLICY=passive \
9 // RUN: KMP_FORKJOIN_BARRIER_PATTERN='dist,dist' %libomp-run
11 // LLVM ISSUE 80664: https://github.com/llvm/llvm-project/issues/80664
13 // Distributed barrier + OMP_WAIT_POLICY=passive hangs in library termination
14 // Reason: the resume logic in __kmp_free_team() was faulty and, when checking
15 // for sleep status, didn't look at correct location for distributed barrier.
17 #include <stdio.h>
18 #include <stdlib.h>
20 int a = 0;
22 void test_omp_barrier() {
23 #pragma omp parallel
25 #pragma omp task
27 #pragma omp atomic
28 a++;
33 int main() {
34 test_omp_barrier();
35 printf("a = %d\n", a);
36 return EXIT_SUCCESS;