The following code produces a warning about an uninitialized variable: dataArray.
However if I remove the if statement before the while loop, no warnings are produced. It seems that the sub-scope of the if (or just inserting { } before the while gives the warning) confuses cppcheck about the value of the dataValue variable.
The following code produces a warning about an uninitialized variable: dataArray.
However if I remove the if statement before the while loop, no warnings are produced. It seems that the sub-scope of the if (or just inserting { } before the while gives the warning) confuses cppcheck about the value of the dataValue variable.
Checking cppcheck_mini.c ...
cppcheck_mini.c:20:11: warning: Uninitialized variable: dataArray [uninitvar]
return dataArray[0] + b;
^
cppcheck_mini.c:14:21: note: Assuming condition is false
while (dataValue < 100)
^
cppcheck_mini.c:20:11: note: Uninitialized variable: dataArray
return dataArray[0] + b;
^
Looks similar to https://trac.cppcheck.net/ticket/11354