xref: /aosp_15_r20/external/compiler-rt/test/tsan/mutex_bad_unlock.cc (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2*7c3d14c8STreehugger Robot extern "C" void AnnotateRWLockReleased(const char *f, int l, void *m, long rw);
3*7c3d14c8STreehugger Robot 
main()4*7c3d14c8STreehugger Robot int main() {
5*7c3d14c8STreehugger Robot   int m = 0;
6*7c3d14c8STreehugger Robot   AnnotateRWLockReleased(__FILE__, __LINE__, &m, 1);
7*7c3d14c8STreehugger Robot   return 0;
8*7c3d14c8STreehugger Robot }
9*7c3d14c8STreehugger Robot 
10*7c3d14c8STreehugger Robot // CHECK: WARNING: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread)
11*7c3d14c8STreehugger Robot // CHECK:     #0 AnnotateRWLockReleased
12*7c3d14c8STreehugger Robot // CHECK:     #1 main
13*7c3d14c8STreehugger Robot // CHECK: Location is stack of main thread.
14*7c3d14c8STreehugger Robot // CHECK:   Mutex {{.*}} created at:
15*7c3d14c8STreehugger Robot // CHECK:     #0 AnnotateRWLockReleased
16*7c3d14c8STreehugger Robot // CHECK:     #1 main
17*7c3d14c8STreehugger Robot // CHECK: SUMMARY: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread)
18*7c3d14c8STreehugger Robot 
19