Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / ignorelist.cpp
blobdc7ed6d9f34cbb406a3ea0989eb0b26776c96cf0
1 // Test ignorelist functionality for TSan.
3 // RUN: echo "fun:*Ignorelisted_Thread2*" > %t.ignorelist
4 // RUN: %clangxx_tsan -O1 %s -fsanitize-ignorelist=%t.ignorelist -o %t && %run %t 2>&1 | FileCheck %s
5 #include <pthread.h>
6 #include <stdio.h>
8 int Global;
10 void *Thread1(void *x) {
11 Global++;
12 return NULL;
15 void *Ignorelisted_Thread2(void *x) {
16 Global--;
17 return NULL;
20 int main() {
21 pthread_t t[2];
22 pthread_create(&t[0], NULL, Thread1, NULL);
23 pthread_create(&t[1], NULL, Ignorelisted_Thread2, NULL);
24 pthread_join(t[0], NULL);
25 pthread_join(t[1], NULL);
26 fprintf(stderr, "PASS\n");
27 return 0;
30 // CHECK-NOT: ThreadSanitizer: data race