Fix assertion failure in evalSameCondition (#5770)
This commit is contained in:
parent
7191ed92b9
commit
ef27c29f27
|
@ -1290,6 +1290,7 @@ namespace {
|
||||||
}))
|
}))
|
||||||
return false;
|
return false;
|
||||||
std::sort(conditions.begin(), conditions.end(), &TokenExprIdCompare);
|
std::sort(conditions.begin(), conditions.end(), &TokenExprIdCompare);
|
||||||
|
conditions.erase(std::unique(conditions.begin(), conditions.end(), &TokenExprIdCompare), conditions.end());
|
||||||
return !conditions.empty() && conditions.front()->exprId() != 0;
|
return !conditions.empty() && conditions.front()->exprId() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1357,8 +1358,8 @@ namespace {
|
||||||
return value;
|
return value;
|
||||||
std::vector<const Token*> diffConditions1 = setDifference(conditions1, conditions2);
|
std::vector<const Token*> diffConditions1 = setDifference(conditions1, conditions2);
|
||||||
std::vector<const Token*> diffConditions2 = setDifference(conditions2, conditions1);
|
std::vector<const Token*> diffConditions2 = setDifference(conditions2, conditions1);
|
||||||
pruneConditions(diffConditions1, b, condValues);
|
pruneConditions(diffConditions1, !b, condValues);
|
||||||
pruneConditions(diffConditions2, b, executeAll(diffConditions2));
|
pruneConditions(diffConditions2, !b, executeAll(diffConditions2));
|
||||||
if (diffConditions1.size() != diffConditions2.size())
|
if (diffConditions1.size() != diffConditions2.size())
|
||||||
continue;
|
continue;
|
||||||
if (diffConditions1.size() == conditions1.size())
|
if (diffConditions1.size() == conditions1.size())
|
||||||
|
|
|
@ -7549,6 +7549,15 @@ private:
|
||||||
" str += s.to_string();\n"
|
" str += s.to_string();\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
valueOfTok(code, "s");
|
valueOfTok(code, "s");
|
||||||
|
|
||||||
|
code = "void a(int e, int d, int c, int h) {\n"
|
||||||
|
" std::vector<int> b;\n"
|
||||||
|
" std::vector<int> f;\n"
|
||||||
|
" if (b == f && h)\n"
|
||||||
|
" return;\n"
|
||||||
|
" if (b == f && b == f && c && e < d) {}\n"
|
||||||
|
"}\n";
|
||||||
|
valueOfTok(code, "b");
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowUnknownMixedOperators() {
|
void valueFlowUnknownMixedOperators() {
|
||||||
|
|
Loading…
Reference in New Issue