2 * parallel-simple.c -- Archer testcase
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 //===----------------------------------------------------------------------===//
15 // RUN: %libarcher-compile && env OMP_TOOL_VERBOSE_INIT=stderr %libarcher-run 2>&1 | FileCheck %s --check-prefixes CHECK,TSAN_ON
16 // RUN: %clang-archer %openmp_flags %flags %s -o %t && env OMP_TOOL_VERBOSE_INIT=stderr %t 2>&1 | FileCheck %s --check-prefixes CHECK,TSAN_OFF
21 // TSAN_ON: ----- START LOGGING OF TOOL REGISTRATION -----
22 // TSAN_ON-NEXT: Search for OMP tool in current address space... Failed.
23 // TSAN_ON-NEXT: No OMP_TOOL_LIBRARIES defined.
24 // TSAN_ON-NEXT: ...searching tool libraries failed. Using archer tool.
25 // TSAN_ON-NEXT: Opening libarcher.so... Success.
26 // TSAN_ON-NEXT: Searching for ompt_start_tool in libarcher.so... Success.
27 // TSAN_ON-NEXT: Tool was started and is using the OMPT interface.
28 // TSAN_ON-NEXT: ----- END LOGGING OF TOOL REGISTRATION -----
30 // TSAN_OFF: ----- START LOGGING OF TOOL REGISTRATION -----
31 // TSAN_OFF-NEXT: Search for OMP tool in current address space... Failed.
32 // TSAN_OFF-NEXT: No OMP_TOOL_LIBRARIES defined.
33 // TSAN_OFF-NEXT: ...searching tool libraries failed. Using archer tool.
34 // TSAN_OFF-NEXT: Opening libarcher.so... Success.
35 // TSAN_OFF-NEXT: Searching for ompt_start_tool in libarcher.so... Found but not using the OMPT interface.
36 // TSAN_OFF-NEXT: No OMP tool loaded.
37 // TSAN_OFF-NEXT: ----- END LOGGING OF TOOL REGISTRATION -----
40 int main(int argc
, char *argv
[]) {
43 #pragma omp parallel num_threads(2) shared(var)
45 if (omp_get_thread_num() == 1) {
52 fprintf(stderr
, "DONE\n");
53 int error
= (var
!= 2);
57 // CHECK-NOT: ThreadSanitizer: data race
58 // CHECK-NOT: ThreadSanitizer: reported
59 // CHECK-NOT: Warning: please export TSAN_OPTIONS