File tree Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 1
- CORE broken-smt-backend
1
+ CORE
2
2
main.c
3
3
--floatbv
4
4
^EXIT=0$
Original file line number Diff line number Diff line change 1
- CORE smt-backend broken-smt-backend
1
+ CORE smt-backend
2
2
main.c
3
3
--smt2
4
4
^EXIT=10$
Original file line number Diff line number Diff line change 1
- CORE broken-smt-backend
1
+ CORE
2
2
main.c
3
3
--floatbv --no-simplify
4
4
^EXIT=0$
Original file line number Diff line number Diff line change @@ -2280,12 +2280,13 @@ void smt2_convt::convert_typecast(const typecast_exprt &expr)
2280
2280
// adding the rounding mode. See
2281
2281
// smt2_convt::convert_floatbv_typecast.
2282
2282
// The exception is bool and c_bool to float.
2283
+ const auto &dest_floatbv_type = to_floatbv_type (dest_type);
2283
2284
2284
2285
if (src_type.id ()==ID_bool)
2285
2286
{
2286
2287
constant_exprt val (irep_idt (), dest_type);
2287
2288
2288
- ieee_floatt a (to_floatbv_type (dest_type) );
2289
+ ieee_floatt a (dest_floatbv_type );
2289
2290
2290
2291
mp_integer significand;
2291
2292
mp_integer exponent;
@@ -2316,6 +2317,23 @@ void smt2_convt::convert_typecast(const typecast_exprt &expr)
2316
2317
const typecast_exprt tmp (src, bool_typet ());
2317
2318
convert_typecast (typecast_exprt (tmp, dest_type));
2318
2319
}
2320
+ else if (src_type.id () == ID_bv)
2321
+ {
2322
+ if (to_bv_type (src_type).get_width () != dest_floatbv_type.get_width ())
2323
+ {
2324
+ UNEXPECTEDCASE (" Typecast bv -> float with wrong width" );
2325
+ }
2326
+
2327
+ if (use_FPA_theory)
2328
+ {
2329
+ out << " ((_ to_fp " << dest_floatbv_type.get_e () << " "
2330
+ << dest_floatbv_type.get_f () + 1 << " ) " ;
2331
+ convert_expr (src);
2332
+ out << ' )' ;
2333
+ }
2334
+ else
2335
+ convert_expr (src);
2336
+ }
2319
2337
else
2320
2338
UNEXPECTEDCASE (" Unknown typecast " +src_type.id_string ()+" -> float" );
2321
2339
}
You can’t perform that action at this time.
0 commit comments