Bug hunting: Do not warn about 'Division by zero' when variable is uninitialized

This commit is contained in:
Daniel Marjamäki 2020-04-29 11:00:24 +02:00
parent 5d67fd0e56
commit daea5e2d6c
1 changed files with 2 additions and 0 deletions

View File

@ -1975,6 +1975,8 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
return; return;
if (tok->hasKnownIntValue() && tok->getKnownIntValue() != 0) if (tok->hasKnownIntValue() && tok->getKnownIntValue() != 0)
return; return;
if (value.isUninit())
return;
float f = getKnownFloatValue(tok, 0.0f); float f = getKnownFloatValue(tok, 0.0f);
if (f > 0.0f || f < 0.0f) if (f > 0.0f || f < 0.0f)
return; return;