In Cppcheck 1.89, I'm seeing a new warning that the previous version didn't give. I was able to trigger this false positive with the following minimal code example:
void function(int value)
{
static int array[16] = {0};
if(value > 15)
value = 15; //Bounds check
if(array[value])
puts("This element is already nonzero");
array[value] = 1;
}
The warning would only be valid if it wasn't a static array.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In Cppcheck 1.89, I'm seeing a new warning that the previous version didn't give. I was able to trigger this false positive with the following minimal code example:
The warning would only be valid if it wasn't a static array.
Thanks! I agree it's a fp. I created this ticket: https://trac.cppcheck.net/ticket/9312