Uninitialized variables: Fixed FP when using typeof on uninitialized data in return statement
This commit is contained in:
parent
3d0b4a9f7e
commit
bcc5a82b1d
|
@ -1303,6 +1303,9 @@ bool CheckUninitVar::checkScopeForVariable(const Scope* scope, const Token *tok,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (Token::Match(tok, "sizeof|typeof|offsetof|decltype ("))
|
||||||
|
tok = tok->linkAt(1);
|
||||||
|
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2293,6 +2293,12 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar2("void f() {\n"
|
||||||
|
" struct ABC *abc;\n"
|
||||||
|
" return do_something(typeof(*abc));\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
// Ticket #3486 - Don't crash garbage code
|
// Ticket #3486 - Don't crash garbage code
|
||||||
checkUninitVar2("void f()\n"
|
checkUninitVar2("void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue