Fix 10433: assertion failure in ValueFlow (Interval::fromValues) (#3419)
This commit is contained in:
parent
b0407ea6b4
commit
1cd9d0479d
|
@ -7050,8 +7050,7 @@ ValueType::MatchResult ValueType::matchParameter(const ValueType *call, const Va
|
|||
funcVar->scope() && funcVar->scope()->function && funcVar->scope()->function->templateDef;
|
||||
if (type1 == type2)
|
||||
return ValueType::MatchResult::SAME;
|
||||
if (!templateVar && type1.find("auto") == std::string::npos && type2.find("auto") == std::string::npos &&
|
||||
type1 != type2)
|
||||
if (!templateVar && type1.find("auto") == std::string::npos && type2.find("auto") == std::string::npos)
|
||||
return ValueType::MatchResult::NOMATCH;
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -2409,7 +2409,8 @@ bool Token::hasKnownSymbolicValue(const Token* tok) const
|
|||
return false;
|
||||
return mImpl->mValues &&
|
||||
std::any_of(mImpl->mValues->begin(), mImpl->mValues->end(), [&](const ValueFlow::Value& value) {
|
||||
return value.isSymbolicValue() && value.tokvalue && value.tokvalue->exprId() == tok->exprId();
|
||||
return value.isKnown() && value.isSymbolicValue() && value.tokvalue &&
|
||||
value.tokvalue->exprId() == tok->exprId();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -5585,6 +5585,8 @@ struct SymbolicConditionHandler : SimpleConditionHandler {
|
|||
const Token* valuetok = lhs ? tok->astOperand2() : tok->astOperand1();
|
||||
if (valuetok->hasKnownSymbolicValue(vartok))
|
||||
continue;
|
||||
if (vartok->hasKnownSymbolicValue(valuetok))
|
||||
continue;
|
||||
ValueFlow::Value true_value;
|
||||
ValueFlow::Value false_value;
|
||||
setConditionalValues(tok, !lhs, 0, true_value, false_value);
|
||||
|
|
|
@ -5822,6 +5822,16 @@ private:
|
|||
" a *const d = arguments[c.arg];\n"
|
||||
"}\n";
|
||||
valueOfTok(code, "c");
|
||||
|
||||
code = "void h(char* p, int s) {\n"
|
||||
" char *q = p+s;\n"
|
||||
" char buf[100];\n"
|
||||
" char *b = buf;\n"
|
||||
" ++b;\n"
|
||||
" if (p < q && buf < b)\n"
|
||||
" diff = (buf-b);\n"
|
||||
"}\n";
|
||||
valueOfTok(code, "diff");
|
||||
}
|
||||
|
||||
void valueFlowHang() {
|
||||
|
|
Loading…
Reference in New Issue