1// RUN: %libomp-compile && env OMP_NUM_THREADS='3' %libomp-run
2// RUN: %libomp-compile && env OMP_NUM_THREADS='1' %libomp-run
3
4// Checked gcc 10.1 still does not support detach clause on task construct.
5// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8, gcc-9, gcc-10
6// gcc 11 introduced detach clause, but gomp interface in libomp has no support
7// XFAIL: gcc-11, gcc-12
8// clang supports detach clause since version 11.
9// UNSUPPORTED: clang-10, clang-9, clang-8, clang-7
10// icc compiler does not support detach clause.
11// UNSUPPORTED: icc
12
13#include <omp.h>
14
15int main()
16{
17 #pragma omp parallel
18 #pragma omp master
19 {
20 omp_event_handle_t event;
21 #pragma omp task detach(event)
22 {
23 omp_fulfill_event(event);
24 }
25 #pragma omp taskwait
26 }
27 return 0;
28}
29

source code of openmp/runtime/test/tasking/omp_detach_taskwait.c