diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2014-04-25 07:55:11 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2014-04-25 07:55:11 +0000 |
commit | de4456c24926e55a431b6ae38224ae1718a286fb (patch) | |
tree | 377f8fc913144c9d4c7769b58325d019e71e3920 /test/tsan/mutex_bad_unlock.cc | |
parent | 54b720ab869bca44b0292ae6715b1964c2fe9310 (diff) |
tsan: better report for bad mutex unlocks
+ fixes crashes due to races on symbolizer, see
https://code.google.com/p/thread-sanitizer/issues/detail?id=55
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@207206 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/mutex_bad_unlock.cc')
-rw-r--r-- | test/tsan/mutex_bad_unlock.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/tsan/mutex_bad_unlock.cc b/test/tsan/mutex_bad_unlock.cc new file mode 100644 index 000000000..dce815caf --- /dev/null +++ b/test/tsan/mutex_bad_unlock.cc @@ -0,0 +1,18 @@ +// RUN: %clangxx_tsan -O1 %s -o %t && not %t 2>&1 | FileCheck %s +extern "C" void AnnotateRWLockReleased(const char *f, int l, void *m, long rw); + +int main() { + int m = 0; + AnnotateRWLockReleased(__FILE__, __LINE__, &m, 1); + return 0; +} + +// CHECK: WARNING: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread) +// CHECK: #0 AnnotateRWLockReleased +// CHECK: #1 main +// CHECK: Location is stack of main thread. +// CHECK: Mutex M1 ({{.*}}) created at: +// CHECK: #0 AnnotateRWLockReleased +// CHECK: #1 main +// CHECK: SUMMARY: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread) + |