Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / free_race3.c
blobf38a98c1bfa78a2183a8abfef88abed8850e0ce5
1 // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
3 #include "test.h"
5 int *mem;
7 void *Thread(void *x) {
8 mem[0] = 42;
9 barrier_wait(&barrier);
10 return NULL;
13 int main() {
14 barrier_init(&barrier, 2);
15 mem = (int*)malloc(100);
16 pthread_t t;
17 pthread_create(&t, 0, Thread, 0);
18 barrier_wait(&barrier);
19 free(mem);
20 pthread_join(t, NULL);
21 return 0;
24 // CHECK: WARNING: ThreadSanitizer: data race
25 // CHECK: Write of size 8 at {{.*}} by main thread{{.*}}:
26 // CHECK: #0 free
27 // CHECK: #{{(1|2)}} main
28 // CHECK: Previous write of size 4 at {{.*}} by thread T1{{.*}}:
29 // CHECK: #0 Thread