diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h index 0749f633b4bcf..1664b92b21369 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h @@ -120,7 +120,7 @@ class DeadlockDetectorTLS { u32 lock; u32 stk; }; - LockWithContext all_locks_with_contexts_[64]; + LockWithContext all_locks_with_contexts_[128]; uptr n_all_locks_; }; diff --git a/compiler-rt/test/tsan/many_held_mutex.cpp b/compiler-rt/test/tsan/many_held_mutex.cpp new file mode 100644 index 0000000000000..76e072b35a233 --- /dev/null +++ b/compiler-rt/test/tsan/many_held_mutex.cpp @@ -0,0 +1,21 @@ +// RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -fsanitize=thread -o %t +// RUN: %run %t 128 + +#include +#include +#include + +int main(int argc, char *argv[]) { + int num_of_mtx = std::atoi(argv[1]); + + std::vector mutexes(num_of_mtx); + + for (auto &mu : mutexes) { + mu.lock(); + } + for (auto &mu : mutexes) { + mu.unlock(); + } + + return 0; +}