[compiler-rt] 326b005 - sanitizer_common: use 0 for empty stack id

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 12 03:24:33 PDT 2021


Author: Dmitry Vyukov
Date: 2021-07-12T12:24:27+02:00
New Revision: 326b0054fd32ecaa6da0c7ae014fb9bbf1e80048

URL: https://github.com/llvm/llvm-project/commit/326b0054fd32ecaa6da0c7ae014fb9bbf1e80048
DIFF: https://github.com/llvm/llvm-project/commit/326b0054fd32ecaa6da0c7ae014fb9bbf1e80048.diff

LOG: sanitizer_common: use 0 for empty stack id

We use 0 for empty stack id from stack depot.
Deadlock detector 1 is the only place that uses -1
as a special case. Use 0 because there is a number
of checks of the form "if (stack id) ...".

Reviewed By: melver

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector1.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector1.cpp
index 2c924f5d3963..ccb7065b07ae 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector1.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector1.cpp
@@ -136,7 +136,7 @@ void DD::ReportDeadlock(DDCallback *cb, DDMutex *m) {
     DDMutex *m0 = (DDMutex*)dd.getData(from);
     DDMutex *m1 = (DDMutex*)dd.getData(to);
 
-    u32 stk_from = -1U, stk_to = -1U;
+    u32 stk_from = 0, stk_to = 0;
     int unique_tid = 0;
     dd.findEdge(from, to, &stk_from, &stk_to, &unique_tid);
     // Printf("Edge: %zd=>%zd: %u/%u T%d\n", from, to, stk_from, stk_to,


        


More information about the llvm-commits mailing list