From 5d67fd0e566ede7a7955b2567b00a4d20976f061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 29 Apr 2020 10:58:01 +0200 Subject: [PATCH] Bug hunting: Set 'inconclusive' flag for bailout values --- lib/exprengine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp index 12ee6a510..df3ceee4d 100644 --- a/lib/exprengine.cpp +++ b/lib/exprengine.cpp @@ -1986,8 +1986,9 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer, dataBase->addError(tok->linenr()); std::list callstack{settings->clang ? tok : tok->astParent()}; const char * const id = (tok->valueType() && tok->valueType()->isFloat()) ? "bughuntingDivByZeroFloat" : "bughuntingDivByZero"; - ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, id, "There is division, cannot determine that there can't be a division by zero.", CWE(369), false); - if (value.type != ExprEngine::ValueType::BailoutValue) + const bool bailout = (value.type == ExprEngine::ValueType::BailoutValue); + ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, id, "There is division, cannot determine that there can't be a division by zero.", CWE(369), bailout); + if (!bailout) errmsg.function = dataBase->currentFunction; errorLogger->reportErr(errmsg); }