Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / mutex_destroy_locked2.cpp
blobe29c96138a8e4f36705ba597ba5e7f82b807110e
1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2 #include <pthread.h>
3 #include <unistd.h>
5 void *thread(void *arg) {
6 pthread_mutex_t m;
7 pthread_mutex_init(&m, 0);
8 pthread_mutex_lock(&m);
9 pthread_mutex_destroy(&m);
10 return 0;
13 int main() {
14 pthread_t th;
15 pthread_create(&th, 0, thread, 0);
16 pthread_join(th, 0);
17 return 0;
20 // CHECK: WARNING: ThreadSanitizer: destroy of a locked mutex
21 // CHECK: #0 pthread_mutex_destroy
22 // CHECK: #1 thread
23 // CHECK: and:
24 // CHECK: #0 pthread_mutex_lock
25 // CHECK: #1 thread
26 // CHECK: Mutex {{.*}} created at:
27 // CHECK: #0 pthread_mutex_init
28 // CHECK: #1 thread
29 // CHECK: SUMMARY: ThreadSanitizer: destroy of a locked mutex {{.*}} in thread