@@ -1586,7 +1586,8 @@ void smt2_convt::convert_expr(const exprt &expr)
1586
1586
// SMT2 requires the shift distance to have the same width as
1587
1587
// the value that is shifted -- odd!
1588
1588
1589
- if (shift_expr.distance ().type ().id () == ID_integer)
1589
+ const auto &distance_type = shift_expr.distance ().type ();
1590
+ if (distance_type.id () == ID_integer || distance_type.id () == ID_natural)
1590
1591
{
1591
1592
const mp_integer i =
1592
1593
numeric_cast_v<mp_integer>(to_constant_expr (shift_expr.distance ()));
@@ -1597,13 +1598,12 @@ void smt2_convt::convert_expr(const exprt &expr)
1597
1598
convert_expr (tmp);
1598
1599
}
1599
1600
else if (
1600
- shift_expr.distance ().type ().id () == ID_signedbv ||
1601
- shift_expr.distance ().type ().id () == ID_unsignedbv ||
1602
- shift_expr.distance ().type ().id () == ID_c_enum ||
1603
- shift_expr.distance ().type ().id () == ID_c_bool)
1601
+ distance_type.id () == ID_signedbv ||
1602
+ distance_type.id () == ID_unsignedbv ||
1603
+ distance_type.id () == ID_c_enum || distance_type.id () == ID_c_bool)
1604
1604
{
1605
1605
std::size_t width_op0 = boolbv_width (shift_expr.op ().type ());
1606
- std::size_t width_op1 = boolbv_width (shift_expr. distance (). type () );
1606
+ std::size_t width_op1 = boolbv_width (distance_type );
1607
1607
1608
1608
if (width_op0==width_op1)
1609
1609
convert_expr (shift_expr.distance ());
@@ -1621,9 +1621,11 @@ void smt2_convt::convert_expr(const exprt &expr)
1621
1621
}
1622
1622
}
1623
1623
else
1624
+ {
1624
1625
UNEXPECTEDCASE (
1625
1626
" unsupported distance type for " + shift_expr.id_string () + " : " +
1626
- type.id_string ());
1627
+ distance_type.id_string ());
1628
+ }
1627
1629
1628
1630
out << " )" ; // bv*sh
1629
1631
}
0 commit comments