Skip to content

Commit 1221eae

Browse files
authored
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.
1 parent b3b6a83 commit 1221eae

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

orchagent/orch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ set<string> Orch::generateIdListFromMap(unsigned long idsMap, sai_uint32_t maxId
697697
{
698698
unsigned long currentIdMask = 1;
699699
bool started = false, needGenerateMap = false;
700-
sai_uint32_t lower, upper;
700+
sai_uint32_t lower = 0, upper = 0;
701701
set<string> idStringList;
702702
for (sai_uint32_t id = 0; id <= maxId; id ++)
703703
{

0 commit comments

Comments
 (0)