Alexey Serbin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/23062 )
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 invalid trailer content. We now use a single `rand()` call (after seeding via `SeedRandom()`) and extract 3 bytes from the result. This better aligns with the test's intent and ensures non-fixed garbage data. 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 Reviewed-on: http://gerrit.cloudera.org:8080/23062 Tested-by: Alexey Serbin <[email protected]> Reviewed-by: Alexey Serbin <[email protected]> --- 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, 22 insertions(+), 10 deletions(-) Approvals: Alexey Serbin: Looks good to me, approved; Verified -- 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: merged Gerrit-Change-Id: Ic6442c5b0d8087f6360916070299278fcc41d39b Gerrit-Change-Number: 23062 Gerrit-PatchSet: 4 Gerrit-Owner: KeDeng <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: KeDeng <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120)
