[PATCH] D122632: [scudo] Initialize local variable to avoid compiler warning

Dominic Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 21:56:24 PDT 2022


ddcc created this revision.
ddcc added a reviewer: vitalybuka.
Herald added a project: All.
ddcc requested review of this revision.
Herald added a project: Sanitizers.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122632

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


Index: compiler-rt/lib/scudo/standalone/secondary.h
===================================================================
--- compiler-rt/lib/scudo/standalone/secondary.h
+++ compiler-rt/lib/scudo/standalone/secondary.h
@@ -232,7 +232,7 @@
     const u32 MaxCount = atomic_load_relaxed(&MaxEntriesCount);
     bool Found = false;
     CachedBlock Entry;
-    uptr HeaderPos;
+    uptr HeaderPos = 0;
     {
       ScopedLock L(Mutex);
       if (EntriesCount == 0)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122632.418782.patch
Type: text/x-patch
Size: 463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220329/c09f9973/attachment.bin>


More information about the llvm-commits mailing list