File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -4065,6 +4065,22 @@ void smt2_convt::convert_minus(const minus_exprt &expr)
40654065 " unsupported operand types for -: " + expr.op0 ().type ().id_string () +
40664066 " and " + expr.op1 ().type ().id_string ());
40674067 }
4068+ else if (expr.type ().id () == ID_range)
4069+ {
4070+ auto &range_type = to_range_type (expr.type ());
4071+
4072+ // sub: lhs + from - (rhs + from) - from = lhs - rhs - from
4073+ mp_integer from = range_type.get_from ();
4074+ const auto size = range_type.get_to () - range_type.get_from () + 1 ;
4075+ const auto width = address_bits (size);
4076+
4077+ out << " (bvsub " ;
4078+ convert_expr (expr.op0 ());
4079+ out << " (bvsub " ;
4080+ convert_expr (expr.op1 ());
4081+ out << " (_ bv" << range_type.get_from () << ' ' << width
4082+ << " )))" ; // bv, bvsub, bvsub
4083+ }
40684084 else
40694085 UNEXPECTEDCASE (" unsupported type for -: " +expr.type ().id_string ());
40704086}
You can’t perform that action at this time.
0 commit comments