[compiler-rt] 170a8c1 - sanitizer_common: avoid compiler-interted memset in deadlock detector

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 28 11:27:43 PDT 2021


Author: Dmitry Vyukov
Date: 2021-07-28T20:27:38+02:00
New Revision: 170a8c12843db3dc10b544c0fc5b3f19566ee940

URL: https://github.com/llvm/llvm-project/commit/170a8c12843db3dc10b544c0fc5b3f19566ee940
DIFF: https://github.com/llvm/llvm-project/commit/170a8c12843db3dc10b544c0fc5b3f19566ee940.diff

LOG: sanitizer_common: avoid compiler-interted memset in deadlock detector

Compilers tends to insert memset/memcpy for some struct/array operations,
and these don't play well inside of sanitizer runtimes.
Avoiding these calls was the intention behind internal_memset.
Remove the leftover ={} that can result in memset call.

Reviewed By: vitalybuka, pgousseau

Differential Revision: https://reviews.llvm.org/D106978

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_mutex.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_mutex.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_mutex.cpp
index 46f1d0279ca1d..1c177d8e7cca3 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_mutex.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_mutex.cpp
@@ -73,7 +73,7 @@ void DebugMutexInit() {
   // Build adjacency matrix.
   bool leaf[kMutexTypeMax];
   internal_memset(&leaf, 0, sizeof(leaf));
-  int cnt[kMutexTypeMax] = {};
+  int cnt[kMutexTypeMax];
   internal_memset(&cnt, 0, sizeof(cnt));
   for (int t = 0; t < kMutexTypeMax; t++) {
     mutex_type_count = t;


        


More information about the llvm-commits mailing list