Fixed #2764 (False positive: Uninitialized variable '&(x[0])')

This commit is contained in:
Daniel Marjamäki 2011-05-05 21:26:18 +02:00
parent 9e97da8a57
commit b9ee867344
2 changed files with 7 additions and 0 deletions

View File

@ -384,6 +384,7 @@ private:
break;
if (tok2->varId() &&
!Token::Match(tok2->previous(), "&|::") &&
!Token::simpleMatch(tok2->tokAt(-2), "& (") &&
!Token::simpleMatch(tok2->next(), "="))
{
// Multiple assignments..

View File

@ -958,6 +958,12 @@ private:
"}\n");
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"
"{\n"
" char c[50] = \"\";\n"