Hi there,
Thank you for your work on cppcheck!
For the following C code:
struct foo { int x; }; int main(void) { struct foo bar; (&bar)->x = 1; if (bar.x == 0) { } return 0; }
cppcheck 2.0 reports:
Checking test.c ... test.c:8:10: error: Uninitialized variable: x [uninitvar] if (bar.x == 0) { } ^
Using an intermediate variable silences the warning:
struct foo *baz = &bar; baz->x = 1;
So does lack of indirection, of course:
bar.x = 1;
"git bisect" claims that commit 7368a54629a0174383cedfdb4ec5e4b73475cfa3 is the culprit.
Please let me know if any further information and/or experiments would help.
This issue appears to have been fixed by commit 72fa5f2e2729bc8ccf79cfb24ab4ac5a35f9faad, i.e. in cppcheck 2.2.
Log in to post a comment.
Hi there,
Thank you for your work on cppcheck!
For the following C code:
cppcheck 2.0 reports:
Using an intermediate variable silences the warning:
So does lack of indirection, of course:
"git bisect" claims that commit 7368a54629a0174383cedfdb4ec5e4b73475cfa3 is the culprit.
Please let me know if any further information and/or experiments would help.
This issue appears to have been fixed by commit 72fa5f2e2729bc8ccf79cfb24ab4ac5a35f9faad, i.e. in cppcheck 2.2.