xref: /llvm-project/openmp/tools/archer/tests/task/task_early_fulfill.c (revision c46ccb8538c5c0b4724a842e110ad46d7e1b107a)
1e99207feSJoachim Protze // RUN: %libarcher-compile -fopenmp-version=50 && env OMP_NUM_THREADS='3' \
2e99207feSJoachim Protze // RUN:    %libarcher-run
3e99207feSJoachim Protze //| FileCheck %s
4e99207feSJoachim Protze 
5*c46ccb85SJoachim Protze // Checked gcc 10.1 still does not support detach clause on task construct.
6*c46ccb85SJoachim Protze // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8, gcc-9, gcc-10
7*c46ccb85SJoachim Protze // gcc 11 introduced detach clause, but gomp interface in libomp has no support
8*c46ccb85SJoachim Protze // XFAIL: gcc-11, gcc-12
9e99207feSJoachim Protze // clang supports detach clause since version 11.
10e99207feSJoachim Protze // UNSUPPORTED: clang-10, clang-9, clang-8, clang-7
11e99207feSJoachim Protze // icc compiler does not support detach clause.
12e99207feSJoachim Protze // UNSUPPORTED: icc
13e99207feSJoachim Protze // REQUIRES: tsan
14e99207feSJoachim Protze 
15e99207feSJoachim Protze #include <omp.h>
16e99207feSJoachim Protze #include <stdio.h>
17e99207feSJoachim Protze 
main()18e99207feSJoachim Protze int main() {
19e99207feSJoachim Protze #pragma omp parallel
20e99207feSJoachim Protze #pragma omp master
21e99207feSJoachim Protze   {
22e99207feSJoachim Protze     omp_event_handle_t event;
23e99207feSJoachim Protze #pragma omp task detach(event) if (0)
24e99207feSJoachim Protze     { omp_fulfill_event(event); }
25e99207feSJoachim Protze #pragma omp taskwait
26e99207feSJoachim Protze   }
27e99207feSJoachim Protze   return 0;
28e99207feSJoachim Protze }
29