From 1221eae41788176b5de0db3e869006ff22d2d4ff Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Tue, 13 Feb 2024 17:20:54 -0800 Subject: [PATCH] Explicitly initialize two local variables to 0 (#3046) GCC 12 (in Debian Bookworm) claims that on armhf targets, the `lower` local variable in `Orch::generateIdListFromMap` could potentially be used uninitialized a few lines later when it's being converted to a string. I don't see how that could be the case here, since if the string is being printed, the only code path where this is possible requires `lower` to have been set to something. To silence the warning, set both `lower` and `upper` to 0 explicitly. --- orchagent/orch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orchagent/orch.cpp b/orchagent/orch.cpp index 1e33d7c5eb..d1cbdb89c8 100644 --- a/orchagent/orch.cpp +++ b/orchagent/orch.cpp @@ -697,7 +697,7 @@ set Orch::generateIdListFromMap(unsigned long idsMap, sai_uint32_t maxId { unsigned long currentIdMask = 1; bool started = false, needGenerateMap = false; - sai_uint32_t lower, upper; + sai_uint32_t lower = 0, upper = 0; set idStringList; for (sai_uint32_t id = 0; id <= maxId; id ++) {