uninitialized variables: fixed fp when analysing loops
This commit is contained in:
parent
026514db1a
commit
132aa8d0c4
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue