Verification; callbacks in executeCast

This commit is contained in:
Daniel Marjamäki 2019-12-29 19:17:36 +01:00
parent 9723b28385
commit 29b599b0e5
2 changed files with 8 additions and 4 deletions

View File

@ -1124,11 +1124,15 @@ static ExprEngine::ValuePtr executeCast(const Token *tok, Data &data)
return std::make_shared<ExprEngine::ArrayValue>(data.getNewSymbolName(), bufferSize, range, true, nullPointer, uninitPointer);
}
if (val)
if (val) {
// TODO: Cast this..
call(data.callbacks, tok, val, &data);
return val;
}
return getValueRangeFromValueType(data.getNewSymbolName(), tok->valueType(), *data.settings);
val = getValueRangeFromValueType(data.getNewSymbolName(), tok->valueType(), *data.settings);
call(data.callbacks, tok, val, &data);
return val;
}
static ExprEngine::ValuePtr executeDot(const Token *tok, Data &data)

View File

@ -9,7 +9,7 @@ void pointer2(int *p) {
return 100000 / p[32];
}
void float(float f) {
void float1(float f) {
// cppcheck-suppress verificationDivByZero
return 100000 / (int)f;
}
@ -19,7 +19,7 @@ void stdmap(std::map<int,int> &data) {
return 100000 / data[43];
}
struct S { int x };
struct S { int x; };
void struct1(struct S *s) {
// cppcheck-suppress verificationDivByZero
return 100000 / s->x;