From 7fa0342a7c7982967c948b346ba7077dce54efd2 Mon Sep 17 00:00:00 2001 From: ylldummy Date: Thu, 30 May 2024 01:41:35 +0800 Subject: [PATCH] mem-cache: Fix maybe-uninitialized warning (#1179) When compiler tries to inline a vector construction with a default value as default constructed ReplaceableEntry. It can complain about the uninitialized member. Let's provide basic initialization to the members. Example codepath: SignaturePathV2 constructor -> GlobalHistoryEntry() as init_value to AssociativeSet -> AssociativeSet initialize vector with init_value --- src/mem/cache/replacement_policies/replaceable_entry.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mem/cache/replacement_policies/replaceable_entry.hh b/src/mem/cache/replacement_policies/replaceable_entry.hh index bb88cefd1d..aa07f4ec23 100644 --- a/src/mem/cache/replacement_policies/replaceable_entry.hh +++ b/src/mem/cache/replacement_policies/replaceable_entry.hh @@ -73,7 +73,7 @@ class ReplaceableEntry uint32_t _way; public: - ReplaceableEntry() = default; + ReplaceableEntry() : _set(0), _way(0) {} virtual ~ReplaceableEntry() = default; /**