Fix uninitialized build warning#6321
Conversation
MaximSmolskiy
commented
Aug 17, 2025
mvieth
left a comment
There was a problem hiding this comment.
Thank you for your pull request. I am pretty sure that the warning is a false positive: strongest_peak is only read from if peak_counter is not zero (line 191), which can only happen if strongest_peak was set to something valid (lines 185 and 187). I am assuming you are testing with PCL 1.14.0 or newer, see 053995b
I was also not able to reproduce the warning with GCC 11.5.0, so perhaps the maybe-uninitialized detection logic has been improved between the two compiler versions?
If you would still like to initialize strongest_peak with -1, please add an additional check in line 191, testing that strongest_peak is now different from -1 (to have a consistent logic)
Yes, I also think that warning is false positive. And I think it's better to get rid of such warnings if it's not too difficult
Yes, I tested
There are four related variables - |
I would at least like a check for |