Fixed #2320 (false positive: Uninitialized variable: kbuf)

This commit is contained in:
Daniel Marjamäki 2010-12-18 10:06:21 +01:00
parent 7eb9855104
commit fc9c450eed
2 changed files with 10 additions and 2 deletions

View File

@ -468,7 +468,7 @@ private:
if (Token::Match(tok.previous(), "[(,] %var% [+-,)]"))
{
use(checks, &tok);
use_array(checks, &tok);
//use_array(checks, &tok);
return &tok;
}

View File

@ -953,6 +953,13 @@ private:
" Fred b = a[0];\n"
"}\n");
ASSERT_EQUALS("", errout.str());
// Ticket #2320
checkUninitVar("void foo() {\n"
" char a[2];\n"
" char *b = (a+2) & 7;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
// alloc..
@ -1324,7 +1331,8 @@ private:
" int x[10];\n"
" calc(x,10);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: x\n", errout.str());
TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: x\n", errout.str());
ASSERT_EQUALS("", errout.str());
// using uninitialized function pointer..
checkUninitVar("void foo()\n"