Verify: Fix false negative in itc

This commit is contained in:
Daniel Marjamäki 2019-10-27 15:35:04 +01:00
parent 2c1905cc2b
commit c56a45840a
1 changed files with 2 additions and 1 deletions

View File

@ -23,6 +23,7 @@
#include "tokenize.h" #include "tokenize.h"
#include <cstdlib> #include <cstdlib>
#include <cstring>
#include <limits> #include <limits>
#include <memory> #include <memory>
#include <iostream> #include <iostream>
@ -1443,7 +1444,7 @@ void ExprEngine::executeFunction(const Scope *functionScope, const Tokenizer *to
void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer, const Settings *settings) void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer, const Settings *settings)
{ {
std::function<void(const Token *, const ExprEngine::Value &, ExprEngine::DataBase *)> divByZero = [=](const Token *tok, const ExprEngine::Value &value, ExprEngine::DataBase *dataBase) { std::function<void(const Token *, const ExprEngine::Value &, ExprEngine::DataBase *)> divByZero = [=](const Token *tok, const ExprEngine::Value &value, ExprEngine::DataBase *dataBase) {
if (!Token::Match(tok->astParent(), "[/%]")) if (!tok->astParent() || !std::strchr("/%", tok->astParent()->str()[0]))
return; return;
if (tok->astParent()->astOperand2() == tok && value.isEqual(dataBase, 0)) { if (tok->astParent()->astOperand2() == tok && value.isEqual(dataBase, 0)) {
std::list<const Token*> callstack{tok->astParent()}; std::list<const Token*> callstack{tok->astParent()};