Verification; Avoid fp for array declaration

This commit is contained in:
Daniel Marjamäki 2019-12-31 16:50:09 +01:00
parent 1a2b770bfd
commit 10010eba95
1 changed files with 7 additions and 0 deletions

View File

@ -1824,6 +1824,13 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
if (!value.isUninit())
return;
// Avoid FP for array declaration
const Token *parent = tok->astParent();
while (parent && parent->str() == "[")
parent = parent->astParent();
if (!parent)
return;
dataBase->addError(tok->linenr());
std::list<const Token*> callstack{tok};
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "verificationUninit", "Cannot determine that data is initialized", CWE(908), false);