Fixed #6264 (FP: gimp: struct initialized via pointers to member variables)

This commit is contained in:
Daniel Marjamäki 2015-11-21 19:31:18 +01:00
parent 9757f5b5f4
commit 5f68f3ddf6
2 changed files with 9 additions and 0 deletions

View File

@ -676,6 +676,8 @@ bool CheckUninitVar::checkIfForWhileHead(const Token *startparentheses, const Va
for (const Token *tok = startparentheses->next(); tok && tok != endpar; tok = tok->next()) {
if (tok->varId() == var.declarationId()) {
if (Token::Match(tok, "%name% . %name%")) {
if (membervar.empty())
return true;
if (tok->strAt(2) == membervar) {
if (isMemberVariableAssignment(tok, membervar))
return true;

View File

@ -844,6 +844,13 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
checkUninitVar("void f() {\n"
" C c;\n"
" if (fun(&c.d));\n"
" return c;\n"
"}");
ASSERT_EQUALS("", errout.str());
checkUninitVar("void f() {\n"
" char a[10];\n"
" if (a[0] = x){}\n"