-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fixes for sanitizer errors from SPEC CPU testing #7697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
05bac66
3410738
6f70d59
6c02e8d
2f95d90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,8 +127,12 @@ namespace { | |
Interval result; | ||
const ValueFlow::Value* minValue = getCompareValue(values, predicate, std::less<MathLib::bigint>{}); | ||
if (minValue) { | ||
if (minValue->isImpossible() && minValue->bound == ValueFlow::Value::Bound::Upper) | ||
result.setMinValue(minValue->intvalue + 1, minValue); | ||
if (minValue->isImpossible() && minValue->bound == ValueFlow::Value::Bound::Upper) { | ||
if (std::numeric_limits<long long>::max() == minValue->intvalue) | ||
result.setMinValue(minValue->intvalue, minValue); | ||
else | ||
result.setMinValue(minValue->intvalue + 1, minValue); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if not doing the addition still leads to a useful value, or if we should bail out somehow for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pfultz2 Maybe you have some insights? |
||
} | ||
if (minValue->isPossible() && minValue->bound == ValueFlow::Value::Bound::Lower) | ||
result.setMinValue(minValue->intvalue, minValue); | ||
if (!minValue->isImpossible() && (minValue->bound == ValueFlow::Value::Bound::Point || minValue->isKnown()) && | ||
|
@@ -137,8 +141,12 @@ namespace { | |
} | ||
const ValueFlow::Value* maxValue = getCompareValue(values, predicate, std::greater<MathLib::bigint>{}); | ||
if (maxValue) { | ||
if (maxValue->isImpossible() && maxValue->bound == ValueFlow::Value::Bound::Lower) | ||
result.setMaxValue(maxValue->intvalue - 1, maxValue); | ||
if (maxValue->isImpossible() && maxValue->bound == ValueFlow::Value::Bound::Lower) { | ||
if (std::numeric_limits<long long>::min() == maxValue->intvalue) | ||
result.setMaxValue(minValue->intvalue, maxValue); | ||
else | ||
result.setMaxValue(maxValue->intvalue - 1, maxValue); | ||
} | ||
if (maxValue->isPossible() && maxValue->bound == ValueFlow::Value::Bound::Upper) | ||
result.setMaxValue(maxValue->intvalue, maxValue); | ||
assert(!maxValue->isKnown()); | ||
|
@@ -312,14 +320,20 @@ std::vector<ValueFlow::Value> infer(const ValuePtr<InferModel>& model, | |
result.push_back(std::move(value)); | ||
} else { | ||
if (!diff.minvalue.empty()) { | ||
ValueFlow::Value value(diff.minvalue.front() - 1); | ||
int adder(0); | ||
if (std::numeric_limits<long long>::min() < diff.minvalue.front()) | ||
adder = -1; | ||
ValueFlow::Value value(diff.minvalue.front() + adder); | ||
value.setImpossible(); | ||
value.bound = ValueFlow::Value::Bound::Upper; | ||
addToErrorPath(value, diff.minRef); | ||
result.push_back(std::move(value)); | ||
} | ||
if (!diff.maxvalue.empty()) { | ||
ValueFlow::Value value(diff.maxvalue.front() + 1); | ||
int adder(0); | ||
if (std::numeric_limits<long long>::max() > diff.maxvalue.front()) | ||
adder = 1; | ||
ValueFlow::Value value(diff.maxvalue.front() + adder); | ||
value.setImpossible(); | ||
value.bound = ValueFlow::Value::Bound::Lower; | ||
addToErrorPath(value, diff.maxRef); | ||
|
Uh oh!
There was an error while loading. Please reload this page.