Hello Alexey Serbin, Kudu Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/23062
to look at the new patch set (#2).
Change subject: Fix -Wmaybe-uninitialized warnings on ARM/Rocky Linux builds
......................................................................
Fix -Wmaybe-uninitialized warnings on ARM/Rocky Linux builds
GCC on ARM-based Rocky Linux platforms emits false-positive
-Wmaybe-uninitialized warnings in several locations where
variables are passed to constructors without explicit
initialization, even though the memory is not accessed prior
to being written or used safely.
This patch clarifies or explicitly initializes such variables
to suppress the warnings while preserving the original logic
and intent of each use.
Details:
1. `log_util.cc`: The `scratch` buffers used in header/footer
parsing are now explicitly zero-initialized. While they
are written before use, GCC still warns due to lack of
path-sensitive analysis.
2. `index-test.cc`: In the `CorruptedTrailer` test, a small
`buf[3]` array is used to simulate a corrupted trailer.
Instead of zeroing it, we now fill it with pseudo-random
bytes via `rand()` to better reflect corruption scenarios
and avoid uninitialized warnings.
3. `bloomfile-test-base.cc`: Although `key_buf` was reassigned
in each loop iteration, the warning was triggered due to
its declaration outside the loop. Moving its definition into
the loop eliminates the warning without changing behavior.
4. `env_posix.cc`: Buffers `magic` and `file_key` are now
explicitly initialized. These buffers are written to before
use, but GCC emits spurious warnings otherwise.
These changes make no functional modifications to the code and
are purely to suppress false-positive warnings, ensuring clean
builds with GCC in ARM/Rocky environments.
NOTE: None of these warnings correspond to actual uninitialized
memory access. The memory in question is either not accessed at
all or is initialized before any such use.
Change-Id: Ic6442c5b0d8087f6360916070299278fcc41d39b
---
M src/kudu/cfile/bloomfile-test-base.cc
M src/kudu/cfile/index-test.cc
M src/kudu/consensus/log_util.cc
M src/kudu/util/env_posix.cc
4 files changed, 14 insertions(+), 10 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/62/23062/2
--
To view, visit http://gerrit.cloudera.org:8080/23062
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic6442c5b0d8087f6360916070299278fcc41d39b
Gerrit-Change-Number: 23062
Gerrit-PatchSet: 2
Gerrit-Owner: KeDeng <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)