Uninitialized variables; Added true positive test

This commit is contained in:
Daniel Marjamäki 2021-05-25 07:31:01 +02:00
parent b61eaec5b4
commit 8d97cce81b
1 changed files with 6 additions and 0 deletions

View File

@ -1625,6 +1625,12 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
checkUninitVar("void foo() {\n"
" char buf[1024];\n"
" char x = *(char *) (((uintptr_t) buf + 63) & ~(uintptr_t) 63);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: buf\n", errout.str());
// Passing array to function
checkUninitVar("void f(int i);\n"
"void foo()\n"