[llvm] [llvm] Fix - gcc error: buf may be used uninitialized [-Werror=maybe-uninitialized] (PR #213578)
Arun Thangamani via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 2 18:54:42 PDT 2026
https://github.com/arun-thmn created https://github.com/llvm/llvm-project/pull/213578
None
>From 5cd82cb89285ebce161ccb5e18c90fa62989b9ae Mon Sep 17 00:00:00 2001
From: Arun Thangamani <arun.thangamani at intel.com>
Date: Sun, 2 Aug 2026 18:53:30 -0700
Subject: [PATCH] gcc error: buf may be used uninitialized
[-Werror=maybe-uninitialized]
---
llvm/include/llvm/ADT/Hashing.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h
index bb965bea86d0c..b05598486abc7 100644
--- a/llvm/include/llvm/ADT/Hashing.h
+++ b/llvm/include/llvm/ADT/Hashing.h
@@ -306,7 +306,7 @@ template <typename... Ts> hash_code hash_combine(const Ts &...args) {
constexpr size_t Total = hashing::detail::total_hashable_size<Ts...>();
// Round up so `data()` is non-null when Total == 0; combine_bytes won't
// read the buffer in that case (len=0 short-circuits in xxh3_64bits).
- std::array<char, std::max<size_t>(1, Total)> buf;
+ std::array<char, std::max<size_t>(1, Total)> buf{};
[[maybe_unused]] size_t off = 0;
(hashing::detail::store_hashable_data(buf.data(), off, args), ...);
return hashing::detail::combine_bytes(buf.data(), Total);
More information about the llvm-commits
mailing list