Skip to content

Commit e9131f9

Browse files
tautschnigDaniel Kroening
authored and
Daniel Kroening
committed
Typecast to pointer: support all bitvector types
Even floating-point values are ok to just be re-interpreted as bit strings.
1 parent 26406ac commit e9131f9

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/solvers/flattening/bv_pointers.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,10 @@ bvt bv_pointerst::convert_pointer_type(const exprt &expr)
254254
if(op_type.id()==ID_pointer)
255255
return convert_bv(op);
256256
else if(
257-
op_type.id() == ID_signedbv || op_type.id() == ID_unsignedbv ||
258-
op_type.id() == ID_bool || op_type.id() == ID_c_enum ||
259-
op_type.id() == ID_c_enum_tag || op_type.id() == ID_bv)
257+
can_cast_type<bitvector_typet>(op_type) || op_type.id() == ID_bool ||
258+
op_type.id() == ID_c_enum || op_type.id() == ID_c_enum_tag)
260259
{
261-
// Cast from integer to pointer.
260+
// Cast from a bitvector type to pointer.
262261
// We just do a zero extension.
263262

264263
const bvt &op_bv=convert_bv(op);

src/solvers/smt2/smt2_conv.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,10 @@ std::string smt2_convt::type2id(const typet &type) const
829829
{
830830
return type2id(ns.follow_tag(to_c_enum_tag_type(type)).subtype());
831831
}
832+
else if(type.id() == ID_pointer)
833+
{
834+
return "p" + std::to_string(to_pointer_type(type).get_width());
835+
}
832836
else
833837
{
834838
UNREACHABLE;

0 commit comments

Comments
 (0)