Skip to content

Commit ce3763f

Browse files
authored
programmemory.cpp: perform early exit in Executor::executeImpl() (danmar#7571)
1 parent 8fe790b commit ce3763f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/programmemory.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,10 +1511,12 @@ namespace {
15111511
return ValueFlow::Value{};
15121512
} else if (Token::Match(expr, "%cop%") && expr->astOperand1() && expr->astOperand2()) {
15131513
ValueFlow::Value lhs = execute(expr->astOperand1());
1514+
if (lhs.isUninitValue())
1515+
return unknown();
15141516
ValueFlow::Value rhs = execute(expr->astOperand2());
1515-
ValueFlow::Value r = unknown();
1516-
if (!lhs.isUninitValue() && !rhs.isUninitValue())
1517-
r = evaluate(expr->str(), lhs, rhs);
1517+
if (rhs.isUninitValue())
1518+
return unknown();
1519+
ValueFlow::Value r = evaluate(expr->str(), lhs, rhs);
15181520
if (expr->isComparisonOp() && (r.isUninitValue() || r.isImpossible())) {
15191521
if (rhs.isIntValue() && !expr->astOperand1()->values().empty()) {
15201522
std::vector<ValueFlow::Value> result = infer(makeIntegralInferModel(),

0 commit comments

Comments
 (0)