Fixed #2320 (false positive: Uninitialized variable: kbuf)
This commit is contained in:
parent
7eb9855104
commit
fc9c450eed
|
@ -468,7 +468,7 @@ private:
|
||||||
if (Token::Match(tok.previous(), "[(,] %var% [+-,)]"))
|
if (Token::Match(tok.previous(), "[(,] %var% [+-,)]"))
|
||||||
{
|
{
|
||||||
use(checks, &tok);
|
use(checks, &tok);
|
||||||
use_array(checks, &tok);
|
//use_array(checks, &tok);
|
||||||
return &tok;
|
return &tok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -953,6 +953,13 @@ private:
|
||||||
" Fred b = a[0];\n"
|
" Fred b = a[0];\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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..
|
// alloc..
|
||||||
|
@ -1324,7 +1331,8 @@ private:
|
||||||
" int x[10];\n"
|
" int x[10];\n"
|
||||||
" calc(x,10);\n"
|
" calc(x,10);\n"
|
||||||
"}\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..
|
// using uninitialized function pointer..
|
||||||
checkUninitVar("void foo()\n"
|
checkUninitVar("void foo()\n"
|
||||||
|
|
Loading…
Reference in New Issue