Explicitly initialize two local variables to 0 #3046
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I did
GCC 12 (in Debian Bookworm) claims that on armhf targets, the
lower
local variable inOrch::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 requireslower
to have been set to something. It also only complains about this for armhf and i386 (i.e. 32-bit platforms); amd64 and arm64 (64-bit platforms) are fine. (i386 was manually tested by installing the 32-bit crosscompiler and development headers in a slave container and running the g++ command to compile orch.cpp.)Why I did it
To silence the warning, set both
lower
andupper
to 0 explicitly.How I verified it
Details if related