brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1009 B · 79aa228 Raw
38 lines · c
1// RUN: %libomp-compile2// RUN: env OMP_WAIT_POLICY=passive \3// RUN:     KMP_FORKJOIN_BARRIER_PATTERN='linear,linear' %libomp-run4// RUN: env OMP_WAIT_POLICY=passive \5// RUN:     KMP_FORKJOIN_BARRIER_PATTERN='tree,tree' %libomp-run6// RUN: env OMP_WAIT_POLICY=passive \7// RUN:     KMP_FORKJOIN_BARRIER_PATTERN='hyper,hyper' %libomp-run8// RUN: env OMP_WAIT_POLICY=passive \9// RUN:     KMP_FORKJOIN_BARRIER_PATTERN='dist,dist' %libomp-run10//11// LLVM ISSUE 80664: https://github.com/llvm/llvm-project/issues/8066412//13// Distributed barrier + OMP_WAIT_POLICY=passive hangs in library termination14// Reason: the resume logic in __kmp_free_team() was faulty and, when checking15// for sleep status, didn't look at correct location for distributed barrier.16 17#include <stdio.h>18#include <stdlib.h>19 20int a = 0;21 22void test_omp_barrier() {23#pragma omp parallel24  {25#pragma omp task26    {27#pragma omp atomic28      a++;29    }30  }31}32 33int main() {34  test_omp_barrier();35  printf("a = %d\n", a);36  return EXIT_SUCCESS;37}38