Unfortunately my original case still fails before being cut down . New test case here void f() {
int a[11];
int *p = a;
int height = 10;
int step 1;
for (int i = 0; i < (height * step); i += step)
*p++ = 0;
for (int i = 0; i < height; i++)
if (a[i]) {}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The above gives :
../FP23c.c:12:7: error: Uninitialized variable: screendata [uninitvar]
if (screendata[y]) {
^
../FP23c.c:7:22: note: Assuming condition is false
for (int i = 0; i < (height * step); i += step) {
^
../FP23c.c:12:7: note: Uninitialized variable: screendata
if (screendata[y]) {
Which I think is a new false positive. 2.7 didn't give a false positive
Last edit: dp11 2022-04-25
Thanks for reporting, I have created a ticket: https://trac.cppcheck.net/ticket/11006
Thanks for the fix of 11006.
Unfortunately my original case still fails before being cut down . New test case here
void f() { int a[11]; int *p = a; int height = 10; int step 1; for (int i = 0; i < (height * step); i += step) *p++ = 0; for (int i = 0; i < height; i++) if (a[i]) {} }
There is no FP with https://github.com/chrchr-github/cppcheck/commit/c71033548f57abee39faf9ee9776c653a1a5d4eb for
Sorry something went wrong with cut and paste
This gives :
I have reopened https://trac.cppcheck.net/ticket/11009
int step 1;
is not valid C++.Sorry thats a typo should be int step =1;