2 * taskwait-depend.c -- Archer testcase
3 * derived from DRB165-taskdep4-orig-omp50-yes.c in DataRaceBench
5 //===----------------------------------------------------------------------===//
7 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
9 // See tools/archer/LICENSE.txt for details.
10 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
12 //===----------------------------------------------------------------------===//
14 // RUN: %libarcher-compile-and-run-race | FileCheck %s
15 // RUN: %libarcher-compile-and-run-race-noserial | FileCheck %s
18 #include "ompt/ompt-signal.h"
24 int x
= 0, y
= 2, sem
= 0;
26 #pragma omp task depend(inout : x) shared(x, sem)
29 x
++; // 1st Child Task
32 #pragma omp task shared(y, sem)
35 y
--; // 2nd child task
39 #pragma omp taskwait depend(in : x) // 1st taskwait
43 #pragma omp taskwait // 2nd taskwait
47 #pragma omp parallel num_threads(2)
54 // CHECK: WARNING: ThreadSanitizer: data race
55 // CHECK-NEXT: {{(Write|Read)}} of size 4
56 // CHECK-NEXT: #0 {{.*}}taskwait-depend.c:42
57 // CHECK: Previous write of size 4
58 // CHECK-NEXT: #0 {{.*}}taskwait-depend.c:35
59 // CHECK: ThreadSanitizer: reported {{[0-9]+}} warnings