Uninitialized variables: Fixed FP when using typeof on uninitialized data in return statement

This commit is contained in:
Daniel Marjamäki 2012-12-25 13:31:54 +01:00
parent 3d0b4a9f7e
commit bcc5a82b1d
2 changed files with 9 additions and 0 deletions

View File

@ -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();
} }

View File

@ -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"