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 
main()4 int main() {
5   int m = 0;
6   AnnotateRWLockAcquired(__FILE__, __LINE__, &m, 1);
7   AnnotateRWLockAcquired(__FILE__, __LINE__, &m, 0);
8   return 0;
9 }
10 
11 // CHECK: WARNING: ThreadSanitizer: read lock of a write locked mutex
12 // CHECK:     #0 AnnotateRWLockAcquired
13 // CHECK:     #1 main
14 // CHECK: Location is stack of main thread.
15 // CHECK:   Mutex {{.*}}) created at:
16 // CHECK:     #0 AnnotateRWLockAcquired
17 // CHECK:     #1 main
18 // CHECK: SUMMARY: ThreadSanitizer: read lock of a write locked mutex
19 
20