@@ -1586,7 +1586,8 @@ void smt2_convt::convert_expr(const exprt &expr)
15861586 // SMT2 requires the shift distance to have the same width as
15871587 // the value that is shifted -- odd!
15881588
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)
15901591 {
15911592 const mp_integer i =
15921593 numeric_cast_v<mp_integer>(to_constant_expr (shift_expr.distance ()));
@@ -1597,13 +1598,12 @@ void smt2_convt::convert_expr(const exprt &expr)
15971598 convert_expr (tmp);
15981599 }
15991600 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)
16041604 {
16051605 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 );
16071607
16081608 if (width_op0==width_op1)
16091609 convert_expr (shift_expr.distance ());
@@ -1621,9 +1621,11 @@ void smt2_convt::convert_expr(const exprt &expr)
16211621 }
16221622 }
16231623 else
1624+ {
16241625 UNEXPECTEDCASE (
16251626 " unsupported distance type for " + shift_expr.id_string () + " : " +
1626- type.id_string ());
1627+ distance_type.id_string ());
1628+ }
16271629
16281630 out << " )" ; // bv*sh
16291631 }
0 commit comments