[llvm] [CAS] Fix msan failure attempt 2 (PR #164493)
Steven Wu via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 21 13:52:10 PDT 2025
https://github.com/cachemeifyoucan created https://github.com/llvm/llvm-project/pull/164493
Try to fix msan error again. Previously, the error wasn't correctly
identified as the uninitialized value is in a different function than
the line crashed. Make sure value return from hash generating function
is fully zero initialized.
>From 2b50a95136ae35963784b22cc8c0783d7defbcb4 Mon Sep 17 00:00:00 2001
From: Steven Wu <stevenwu at apple.com>
Date: Tue, 21 Oct 2025 13:51:58 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.7
---
llvm/unittests/CAS/OnDiskCommonUtils.h | 2 +-
llvm/unittests/CAS/OnDiskKeyValueDBTest.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/unittests/CAS/OnDiskCommonUtils.h b/llvm/unittests/CAS/OnDiskCommonUtils.h
index 57c8c228867fd..89f93e08366c9 100644
--- a/llvm/unittests/CAS/OnDiskCommonUtils.h
+++ b/llvm/unittests/CAS/OnDiskCommonUtils.h
@@ -45,7 +45,7 @@ inline HashType digest(StringRef Data) {
}
inline ValueType valueFromString(StringRef S) {
- ValueType Val;
+ ValueType Val = {};
llvm::copy(S.substr(0, sizeof(Val)), Val.data());
return Val;
}
diff --git a/llvm/unittests/CAS/OnDiskKeyValueDBTest.cpp b/llvm/unittests/CAS/OnDiskKeyValueDBTest.cpp
index 19ea8f5d30b71..41512d04b60bd 100644
--- a/llvm/unittests/CAS/OnDiskKeyValueDBTest.cpp
+++ b/llvm/unittests/CAS/OnDiskKeyValueDBTest.cpp
@@ -65,7 +65,7 @@ TEST_F(OnDiskCASTest, OnDiskKeyValueDBTest) {
// Insert a lot of entries.
for (unsigned I = 0; I < 1024 * 100; ++I) {
std::string Index = Twine(I).str();
- ArrayRef<char> Val;
+ std::optional<ArrayRef<char>> Val;
ASSERT_THAT_ERROR(
DB->put(digest(Index), valueFromString(Index)).moveInto(Val),
Succeeded());
More information about the llvm-commits
mailing list