Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / mutex_double_lock.cpp
blob2bef93ace6770421c37fedfa4fdcdeacb32ef65e
1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2 #include "test.h"
4 void *ThreadFunc(void *m) {
5 AnnotateRWLockAcquired(__FILE__, __LINE__, m, 1);
6 return 0;
9 int main() {
10 int m = 0;
11 AnnotateRWLockAcquired(__FILE__, __LINE__, &m, 1);
12 pthread_t th;
13 pthread_create(&th, 0, ThreadFunc, &m);
14 pthread_join(th, 0);
15 return 0;
18 // CHECK: WARNING: ThreadSanitizer: double lock of a mutex
19 // CHECK: #0 AnnotateRWLockAcquired
20 // CHECK: #1 ThreadFunc
21 // CHECK: Location is stack of main thread.
22 // CHECK: Mutex {{.*}} created at:
23 // CHECK: #0 AnnotateRWLockAcquired
24 // CHECK: #1 main
25 // CHECK: SUMMARY: ThreadSanitizer: double lock of a mutex {{.*}}mutex_double_lock.cpp{{.*}}ThreadFunc