[compiler-rt] 9289721 - [scudo] Initialize local variable to avoid compiler warning

Dominic Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 14:26:25 PDT 2022


Author: Dominic Chen
Date: 2022-03-29T14:26:15-07:00
New Revision: 92897217fa1483e437e1716ebcb3b747f2e22dcb

URL: https://github.com/llvm/llvm-project/commit/92897217fa1483e437e1716ebcb3b747f2e22dcb
DIFF: https://github.com/llvm/llvm-project/commit/92897217fa1483e437e1716ebcb3b747f2e22dcb.diff

LOG: [scudo] Initialize local variable to avoid compiler warning

Compiler warns about HeaderPos possibly being uninitialized which should not be possible, but just initialize it anyway

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

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/secondary.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/secondary.h b/compiler-rt/lib/scudo/standalone/secondary.h
index f0468391deeb4..53707d78eb5c9 100644
--- a/compiler-rt/lib/scudo/standalone/secondary.h
+++ b/compiler-rt/lib/scudo/standalone/secondary.h
@@ -232,7 +232,7 @@ template <typename Config> class MapAllocatorCache {
     const u32 MaxCount = atomic_load_relaxed(&MaxEntriesCount);
     bool Found = false;
     CachedBlock Entry;
-    uptr HeaderPos;
+    uptr HeaderPos = 0;
     {
       ScopedLock L(Mutex);
       if (EntriesCount == 0)


        


More information about the llvm-commits mailing list