2 * task-two.c -- Archer testcase
4 //===----------------------------------------------------------------------===//
6 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
8 // See tools/archer/LICENSE.txt for details.
9 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11 //===----------------------------------------------------------------------===//
13 // RUN: %libarcher-compile-and-run-race | FileCheck %s
14 // RUN: %libarcher-compile-and-run-race-noserial | FileCheck %s
22 int main(int argc
, char *argv
[]) {
26 #pragma omp parallel for num_threads(NUM_THREADS) shared(var) \
28 for (i
= 0; i
< NUM_THREADS
; i
++) {
29 #pragma omp task shared(var) if (0) // the task is inlined an executed locally
33 int error
= (var
!= 2);
34 fprintf(stderr
, "DONE\n");
38 // CHECK: WARNING: ThreadSanitizer: data race
39 // CHECK-NEXT: {{(Write|Read)}} of size 4
40 // CHECK-NEXT: #0 {{.*}}task-two.c:30
41 // CHECK: Previous write of size 4
42 // CHECK-NEXT: #0 {{.*}}task-two.c:30
44 // CHECK: ThreadSanitizer: reported {{[0-9]+}} warnings