Mercurial > hg > CbC > CbC_llvm
comparison compiler-rt/test/tsan/race_top_suppression.cpp @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children | 2e18cbf3894f |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
1 // RUN: echo "race_top:TopFunction" > %t.supp | |
2 // RUN: %clangxx_tsan -O1 %s -o %t | |
3 // RUN: %env_tsan_opts=suppressions='%t.supp' %run %t 2>&1 | FileCheck %s | |
4 // RUN: rm %t.supp | |
5 #include "test.h" | |
6 | |
7 int Global; | |
8 | |
9 void TopFunction(int *p) { | |
10 *p = 1; | |
11 } | |
12 | |
13 void *Thread(void *x) { | |
14 barrier_wait(&barrier); | |
15 TopFunction(&Global); | |
16 return 0; | |
17 } | |
18 | |
19 int main() { | |
20 barrier_init(&barrier, 2); | |
21 pthread_t t; | |
22 pthread_create(&t, 0, Thread, 0); | |
23 Global--; | |
24 barrier_wait(&barrier); | |
25 pthread_join(t, 0); | |
26 fprintf(stderr, "DONE\n"); | |
27 } | |
28 | |
29 // CHECK-NOT: WARNING: ThreadSanitizer: data race |