1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2 extern "C" void AnnotateRWLockAcquired(const char *f, int l, void *m, long rw);
3 extern "C" void AnnotateRWLockReleased(const char *f, int l, void *m, long rw);
4
main()5 int main() {
6 int m = 0;
7 AnnotateRWLockAcquired(__FILE__, __LINE__, &m, 1);
8 AnnotateRWLockReleased(__FILE__, __LINE__, &m, 0);
9 return 0;
10 }
11
12 // CHECK: WARNING: ThreadSanitizer: read unlock of a write locked mutex
13 // CHECK: #0 AnnotateRWLockReleased
14 // CHECK: #1 main
15 // CHECK: Location is stack of main thread.
16 // CHECK: Mutex {{.*}}) created at:
17 // CHECK: #0 AnnotateRWLockAcquired
18 // CHECK: #1 main
19 // CHECK: SUMMARY: ThreadSanitizer: read unlock of a write locked mutex
20
21