1// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2#include "test.h"
3
4int main() {
5 int m = 0;
6 AnnotateRWLockAcquired(__FILE__, __LINE__, m: &m, is_w: 1);
7 AnnotateRWLockAcquired(__FILE__, __LINE__, m: &m, is_w: 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

source code of compiler-rt/test/tsan/mutex_bad_read_lock.cpp