diff --git a/openmp/runtime/src/kmp_gsupport.cpp b/openmp/runtime/src/kmp_gsupport.cpp --- a/openmp/runtime/src/kmp_gsupport.cpp +++ b/openmp/runtime/src/kmp_gsupport.cpp @@ -1233,6 +1233,15 @@ OMPT_STORE_RETURN_ADDRESS(gtid); } #endif + if (gomp_flags & 8) { + KMP_ASSERT(depend); + kmp_gomp_depends_info_t gomp_depends(depend); + kmp_int32 ndeps = gomp_depends.get_num_deps(); + kmp_depend_info_t dep_list[ndeps]; + for (kmp_int32 i = 0; i < ndeps; i++) + dep_list[i] = gomp_depends.get_kmp_depend(i); + __kmpc_omp_wait_deps(&loc, gtid, ndeps, dep_list, 0, NULL); + } __kmpc_omp_task_begin_if0(&loc, gtid, task); func(data); diff --git a/openmp/runtime/test/tasking/taskdep_if0.c b/openmp/runtime/test/tasking/taskdep_if0.c new file mode 100644 --- /dev/null +++ b/openmp/runtime/test/tasking/taskdep_if0.c @@ -0,0 +1,39 @@ +// RUN: %libomp-compile-and-run + +#include +#include +#include +#include "omp_my_sleep.h" + +int a = 0; + +void task1() { + my_sleep(0.5); + a = 10; +} + +void task2() { + a++; +} + +int main(int argc, char** argv) +{ + #pragma omp parallel shared(argc) num_threads(2) + { + #pragma omp single + { + #pragma omp task depend(out: a) + task1(); + + #pragma omp task if(0) depend(inout: a) + task2(); + } + } + if (a != 11) { + fprintf(stderr, "fail: expected 11, but a is %d\n", a); + exit(1); + } else { + printf("pass\n"); + } + return 0; +}