uninitvar: Added a regression test for #7736

This commit is contained in:
orbitcowboy 2021-05-15 14:14:16 +02:00
parent 899b88754f
commit e072c2d786
1 changed files with 6 additions and 0 deletions

View File

@ -2249,6 +2249,12 @@ private:
"}"); "}");
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: x\n", errout.str()); ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: x\n", errout.str());
checkUninitVar("void f() {\n" // #7736
" int buf[12];\n"
" printf (\"%d\", buf[0] );\n"
"}");
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: buf\n", errout.str());
checkUninitVar("void f() {\n" checkUninitVar("void f() {\n"
" int x;\n" " int x;\n"
" int y = x & 3;\n" " int y = x & 3;\n"