Execution Path: Fixed FP in improved handling of loop bodies
This commit is contained in:
parent
8f707e5e46
commit
24a2def3ad
|
@ -260,6 +260,11 @@ void ExecutionPath::checkScope(const Token *tok, std::list<ExecutionPath *> &che
|
||||||
|
|
||||||
if (tok->str() != "switch")
|
if (tok->str() != "switch")
|
||||||
{
|
{
|
||||||
|
for (const Token *tok3 = tok; tok3 && tok3 != tok2; tok3 = tok3->next())
|
||||||
|
{
|
||||||
|
if (tok3->varId())
|
||||||
|
ExecutionPath::bailOutVar(checks, tok3->varId());
|
||||||
|
}
|
||||||
check->parseLoopBody(tok2->next(), checks);
|
check->parseLoopBody(tok2->next(), checks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1769,6 +1769,16 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: k\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: k\n", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar("enum ABCD { A, B, C, D };\n"
|
||||||
|
"\n"
|
||||||
|
"static void f(char *str ) {\n"
|
||||||
|
" enum ABCD i;\n"
|
||||||
|
" for (i = 0; i < D; i++) {\n"
|
||||||
|
" str[i] = 0;\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// while..
|
// while..
|
||||||
checkUninitVar("int f()\n"
|
checkUninitVar("int f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue