My bad, I ran it on an incomplete code snippet.
But the warning seems to be a true positive, only one of the two array elements is initialized.
Edit: Although that element is not accessed in the example. I think the check for partial initialization was added recently.
Last edit: CHR 2022-01-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think the following code is an FP regression over 2.6
Gives :
Hmm, I don't get any warning with current head.,,
Just done a git pull and built it and I still get the same error.
My bad, I ran it on an incomplete code snippet.
But the warning seems to be a true positive, only one of the two array elements is initialized.
Edit: Although that element is not accessed in the example. I think the check for partial initialization was added recently.
Last edit: CHR 2022-01-03
Okay Still FP for this case :
and
Thanks for reporting, I have created a ticket here: https://trac.cppcheck.net/ticket/10681
Thanks for creating a ticket
Thanks everyone, just to confirm Changeset 0c9eb5d fixes this issue. I now have a clean cppcheck of my project.
I'm afraid it looks like the latest head has regressed this.
I can't reproduce it with any of the three examples and https://github.com/danmar/cppcheck/commit/4f508c93c4c41e40464b09cff8de7ebd35e8afa3 . What's your command line?
Okay, The FP example above doesn't give me an error. However extending the example very slightly:
gives :
Last edit: dp11 2022-01-13
Thanks, I have reopened the ticket.