Fixed #2188 (Does not detect initialization)
This commit is contained in:
parent
a605bdc8a2
commit
6b489230e8
|
@ -673,7 +673,7 @@ private:
|
||||||
bailouts.insert(tok2->varId());
|
bailouts.insert(tok2->varId());
|
||||||
|
|
||||||
// array initialization..
|
// array initialization..
|
||||||
if (Token::Match(tok2->previous(), "[,(] %var% +"))
|
if (Token::Match(tok2->previous(), "[,(] %var% [+-]"))
|
||||||
{
|
{
|
||||||
// if var is array, bailout
|
// if var is array, bailout
|
||||||
for (std::list<ExecutionPath *>::const_iterator it = checks.begin(); it != checks.end(); ++it)
|
for (std::list<ExecutionPath *>::const_iterator it = checks.begin(); it != checks.end(); ++it)
|
||||||
|
|
|
@ -879,6 +879,14 @@ private:
|
||||||
" s = y[0]*y[1];\n"
|
" s = y[0]*y[1];\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("void foo()\n"
|
||||||
|
"{\n"
|
||||||
|
" int a[2];\n"
|
||||||
|
" init(a - 1);\n"
|
||||||
|
" int b = a[0];\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// alloc..
|
// alloc..
|
||||||
|
|
Loading…
Reference in New Issue