Skip to content

Commit 115687d

Browse files
author
Daniel Kroening
committed
implement cast bv -> floatbv
1 parent c4badee commit 115687d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

regression/cbmc/Float-smt2-1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE smt-backend broken-smt-backend
1+
CORE smt-backend
22
main.c
33
--smt2
44
^EXIT=10$

src/solvers/smt2/smt2_conv.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,6 +2316,20 @@ void smt2_convt::convert_typecast(const typecast_exprt &expr)
23162316
const typecast_exprt tmp(src, bool_typet());
23172317
convert_typecast(typecast_exprt(tmp, dest_type));
23182318
}
2319+
else if(src_type.id() == ID_bv)
2320+
{
2321+
if(
2322+
to_bv_type(src_type).get_width() !=
2323+
to_floatbv_type(dest_type).get_width())
2324+
{
2325+
UNEXPECTEDCASE("Typecast bv -> float with wrong width");
2326+
}
2327+
2328+
if(use_FPA_theory)
2329+
SMT2_TODO("FPA cast bv -> float");
2330+
else
2331+
convert_expr(src);
2332+
}
23192333
else
23202334
UNEXPECTEDCASE("Unknown typecast "+src_type.id_string()+" -> float");
23212335
}

0 commit comments

Comments
 (0)