@@ -1829,7 +1829,8 @@ void smt2_convt::convert_typecast(const typecast_exprt &expr)
1829
1829
src_type.id ()==ID_unsignedbv ||
1830
1830
src_type.id ()==ID_c_bool ||
1831
1831
src_type.id ()==ID_fixedbv ||
1832
- src_type.id ()==ID_pointer)
1832
+ src_type.id ()==ID_pointer ||
1833
+ src_type.id ()==ID_integer)
1833
1834
{
1834
1835
out << " (not (= " ;
1835
1836
convert_expr (src);
@@ -2274,6 +2275,17 @@ void smt2_convt::convert_typecast(const typecast_exprt &expr)
2274
2275
else
2275
2276
UNEXPECTEDCASE (" Unknown typecast " +src_type.id_string ()+" -> float" );
2276
2277
}
2278
+ else if (dest_type.id ()==ID_integer)
2279
+ {
2280
+ if (src_type.id ()==ID_bool)
2281
+ {
2282
+ out << " (ite " ;
2283
+ convert_expr (src);
2284
+ out <<" 1 0)" ;
2285
+ }
2286
+ else
2287
+ UNEXPECTEDCASE (" Unknown typecast " +src_type.id_string ()+" -> integer" );
2288
+ }
2277
2289
else if (dest_type.id ()==ID_c_bit_field)
2278
2290
{
2279
2291
std::size_t from_width=boolbv_width (src_type);
@@ -2917,7 +2929,7 @@ void smt2_convt::convert_plus(const plus_exprt &expr)
2917
2929
2918
2930
mp_integer element_size=
2919
2931
pointer_offset_size (expr.type ().subtype (), ns);
2920
- assert (element_size>0 );
2932
+ CHECK_RETURN (element_size>0 );
2921
2933
2922
2934
out << " (bvadd " ;
2923
2935
convert_expr (p);
@@ -3084,7 +3096,15 @@ void smt2_convt::convert_minus(const minus_exprt &expr)
3084
3096
{
3085
3097
assert (expr.operands ().size ()==2 );
3086
3098
3087
- if (expr.type ().id ()==ID_unsignedbv ||
3099
+ if (expr.type ().id ()==ID_integer)
3100
+ {
3101
+ out << " (- " ;
3102
+ convert_expr (expr.op0 ());
3103
+ out << " " ;
3104
+ convert_expr (expr.op1 ());
3105
+ out << " )" ;
3106
+ }
3107
+ else if (expr.type ().id ()==ID_unsignedbv ||
3088
3108
expr.type ().id ()==ID_signedbv ||
3089
3109
expr.type ().id ()==ID_fixedbv)
3090
3110
{
0 commit comments