Fixed #5510 (FP: nullPointer - variable initialized in function call)
This commit is contained in:
parent
e0574feabd
commit
830249d72e
|
@ -61,6 +61,12 @@ static bool bailoutFunctionPar(const Token *tok, const ValueFlow::Value &value,
|
|||
else
|
||||
return false;
|
||||
|
||||
// reinterpret_cast etc..
|
||||
if (Token::Match(tok->tokAt(-3), "> ( & %var% ) [,)]") &&
|
||||
tok->linkAt(-3) &&
|
||||
Token::Match(tok->linkAt(-3)->tokAt(-2), "[,(] %type% <"))
|
||||
tok = tok->linkAt(-3);
|
||||
|
||||
// goto start of function call and get argnr
|
||||
unsigned int argnr = 0;
|
||||
while (tok && tok->str() != "(") {
|
||||
|
|
|
@ -513,6 +513,13 @@ private:
|
|||
"}";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 4U, 0));
|
||||
|
||||
code = "void f() {\n"
|
||||
" char *x = 0;\n"
|
||||
" getx(reinterpret_cast<void **>(&x));\n"
|
||||
" *x = 0;\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 4U, 0));
|
||||
|
||||
// if/else
|
||||
code = "void f() {\n"
|
||||
" int x = 123;\n"
|
||||
|
|
Loading…
Reference in New Issue