Fixed #2764 (False positive: Uninitialized variable '&(x[0])')
This commit is contained in:
parent
9e97da8a57
commit
b9ee867344
|
@ -384,6 +384,7 @@ private:
|
||||||
break;
|
break;
|
||||||
if (tok2->varId() &&
|
if (tok2->varId() &&
|
||||||
!Token::Match(tok2->previous(), "&|::") &&
|
!Token::Match(tok2->previous(), "&|::") &&
|
||||||
|
!Token::simpleMatch(tok2->tokAt(-2), "& (") &&
|
||||||
!Token::simpleMatch(tok2->next(), "="))
|
!Token::simpleMatch(tok2->next(), "="))
|
||||||
{
|
{
|
||||||
// Multiple assignments..
|
// Multiple assignments..
|
||||||
|
|
|
@ -958,6 +958,12 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("void f() {\n"
|
||||||
|
" char a[10], *p;\n"
|
||||||
|
" p = &(a[10]);\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
checkUninitVar("void f()\n"
|
checkUninitVar("void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" char c[50] = \"\";\n"
|
" char c[50] = \"\";\n"
|
||||||
|
|
Loading…
Reference in New Issue