Fix 11669: Assert failure in infer.cpp (#4982)
* Fix 11669: Assert failure in infer.cpp * Format
This commit is contained in:
parent
4183336dc1
commit
6031bed5a2
|
@ -148,7 +148,7 @@ struct Interval {
|
||||||
result.setMinValue(minValue->intvalue + 1, minValue);
|
result.setMinValue(minValue->intvalue + 1, minValue);
|
||||||
if (minValue->isPossible() && minValue->bound == ValueFlow::Value::Bound::Lower)
|
if (minValue->isPossible() && minValue->bound == ValueFlow::Value::Bound::Lower)
|
||||||
result.setMinValue(minValue->intvalue, minValue);
|
result.setMinValue(minValue->intvalue, minValue);
|
||||||
if (!minValue->isImpossible() && minValue->bound == ValueFlow::Value::Bound::Point &&
|
if (!minValue->isImpossible() && (minValue->bound == ValueFlow::Value::Bound::Point || minValue->isKnown()) &&
|
||||||
std::count_if(values.begin(), values.end(), predicate) == 1)
|
std::count_if(values.begin(), values.end(), predicate) == 1)
|
||||||
return Interval::fromInt(minValue->intvalue, minValue);
|
return Interval::fromInt(minValue->intvalue, minValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7183,6 +7183,17 @@ private:
|
||||||
" a;\n"
|
" a;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
valueOfTok(code, "a");
|
valueOfTok(code, "a");
|
||||||
|
|
||||||
|
code = "void f(int i, int j, int n) {\n"
|
||||||
|
" if ((j == 0) != (i == 0)) {}\n"
|
||||||
|
" int t = 0;\n"
|
||||||
|
" if (j > 0) {\n"
|
||||||
|
" t = 1;\n"
|
||||||
|
" if (n < j)\n"
|
||||||
|
" n = j;\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n";
|
||||||
|
valueOfTok(code, "i");
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowCrashConstructorInitialization() { // #9577
|
void valueFlowCrashConstructorInitialization() { // #9577
|
||||||
|
|
Loading…
Reference in New Issue