uninitialized variables: fixed fp when analysing loops

This commit is contained in:
Daniel Marjamäki 2010-10-25 20:56:15 +02:00
parent 026514db1a
commit 132aa8d0c4
2 changed files with 11 additions and 1 deletions

View File

@ -3778,7 +3778,7 @@ private:
{
while (tok)
{
if (tok->str() == "{" || tok->str() == "}")
if (tok->str() == "{" || tok->str() == "}" || tok->str() == "for")
return;
const Token *next = parse(*tok, checks);
if (next)

View File

@ -1801,6 +1801,16 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
checkUninitVar("void x() {\n"
" do {\n"
" Token * tok;\n"
" for (tok = a; tok; tok = tok->next())\n"
" {\n"
" }\n"
" } while (tok2);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
// while..
checkUninitVar("int f()\n"
"{\n"