Fixed #3060 (False positive: Uninitialized variable: fresh)

This commit is contained in:
Daniel Marjamäki 2011-09-04 12:53:53 +02:00
parent e782d98241
commit 85d83d86ac
2 changed files with 10 additions and 1 deletions

View File

@ -596,8 +596,10 @@ private:
return tok.tokAt(3);
}
else if (Token::simpleMatch(tok.previous(), ">>") || Token::simpleMatch(tok.next(), "="))
else if (Token::Match(tok.previous(), "<<|>>") || Token::simpleMatch(tok.next(), "="))
{
// TODO: Don't bail out for "<<" and ">>" if these are
// just computations
ExecutionPath::bailOutVar(checks, tok.varId());
return &tok;
}

View File

@ -322,6 +322,13 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
checkUninitVar("int a(FArchive &arc) {\n" // #3060 (initialization through operator<<)
" int *p;\n"
" arc << p;\n"
" return *p;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
checkUninitVar("int a()\n"
"{\n"
" int ret;\n"