Uninitialized variables: Fixed fp when initializing struct with function in loop body
This commit is contained in:
parent
96a5429cee
commit
7fdaba43ed
|
@ -1461,6 +1461,8 @@ bool CheckUninitVar::checkLoopBody(const Token *tok, const Variable& var, const
|
|||
|
||||
if (isMemberVariableUsage(tok, var.isPointer(), membervar))
|
||||
usetok = tok;
|
||||
else if (Token::Match(tok->previous(), "[(,] %var% [,)]"))
|
||||
return true;
|
||||
} else {
|
||||
if (isVariableUsage(tok, var.isPointer(), _tokenizer->isCPP()))
|
||||
usetok = tok;
|
||||
|
|
|
@ -2731,6 +2731,14 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// for
|
||||
checkUninitVar2("struct AB { int a; };\n"
|
||||
"void f() {\n"
|
||||
" struct AB ab;\n"
|
||||
" while (x) { clear(ab); z = ab.a; }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// address of member
|
||||
checkUninitVar2("struct AB { int a[10]; int b; };\n"
|
||||
"void f() {\n"
|
||||
|
|
Loading…
Reference in New Issue