Skip to content

Commit 12a4451

Browse files
committed
Use minus_overflow_exprt in simplify_overflow_binary
1 parent fdc0fc8 commit 12a4451

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/util/simplify_expr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ simplify_exprt::simplify_overflow_binary(const binary_overflow_exprt &expr)
21822182
// zero.
21832183
if(
21842184
expr.op1().is_zero() ||
2185-
(expr.op0().is_zero() && expr.id() != ID_overflow_minus))
2185+
(expr.op0().is_zero() && !can_cast_expr<minus_overflow_exprt>(expr)))
21862186
{
21872187
return false_exprt{};
21882188
}
@@ -2208,7 +2208,7 @@ simplify_exprt::simplify_overflow_binary(const binary_overflow_exprt &expr)
22082208
return false_exprt{};
22092209
}
22102210

2211-
if(op_type_id == ID_natural && expr.id() != ID_overflow_minus)
2211+
if(op_type_id == ID_natural && !can_cast_expr<minus_overflow_exprt>(expr))
22122212
return false_exprt{};
22132213

22142214
// we only handle constants over signedbv/unsignedbv for the remaining cases
@@ -2226,7 +2226,7 @@ simplify_exprt::simplify_overflow_binary(const binary_overflow_exprt &expr)
22262226
mp_integer no_overflow_result;
22272227
if(expr.id() == ID_overflow_plus)
22282228
no_overflow_result = *op0_value + *op1_value;
2229-
else if(expr.id() == ID_overflow_minus)
2229+
else if(can_cast_expr<minus_overflow_exprt>(expr))
22302230
no_overflow_result = *op0_value - *op1_value;
22312231
else if(expr.id() == ID_overflow_mult)
22322232
no_overflow_result = *op0_value * *op1_value;

0 commit comments

Comments
 (0)