1// RUN: %libomp-compile-and-run
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <omp.h>
6#include "omp_my_sleep.h"
7
8int a = 0;
9
10void task1() {
11 my_sleep(0.5);
12 a = 10;
13}
14
15void task2() {
16 a++;
17}
18
19int main(int argc, char** argv)
20{
21 #pragma omp parallel shared(argc) num_threads(2)
22 {
23 #pragma omp single
24 {
25 #pragma omp task depend(out: a)
26 task1();
27
28 #pragma omp task if(0) depend(inout: a)
29 task2();
30 }
31 }
32 if (a != 11) {
33 fprintf(stderr, format: "fail: expected 11, but a is %d\n", a);
34 exit(status: 1);
35 } else {
36 printf(format: "pass\n");
37 }
38 return 0;
39}
40

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