Skip to content

Commit ea5c3bc

Browse files
committed
Lower byte_{extract,update} when pointers are involved
This is in preparation of the flattened bit width of pointers not necessarily matching the width claimed by the front-end.
1 parent e6d5d49 commit ea5c3bc

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/solvers/flattening/boolbv_byte_extract.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ bvt map_bv(const bv_endianness_mapt &map, const bvt &src)
3838
bvt boolbvt::convert_byte_extract(const byte_extract_exprt &expr)
3939
{
4040
// array logic does not handle byte operators, thus lower when operating on
41-
// unbounded arrays
42-
if(is_unbounded_array(expr.op().type()))
41+
// unbounded arrays; similarly, byte extracts over pointers are not to be
42+
// handled here
43+
if(
44+
is_unbounded_array(expr.op().type()) ||
45+
has_subtype(expr.type(), ID_pointer, ns) ||
46+
has_subtype(expr.op().type(), ID_pointer, ns))
4347
{
4448
return convert_bv(lower_byte_extract(expr, ns));
4549
}

src/solvers/flattening/boolbv_byte_update.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ Author: Daniel Kroening, [email protected]
2020
bvt boolbvt::convert_byte_update(const byte_update_exprt &expr)
2121
{
2222
// if we update (from) an unbounded array, lower the expression as the array
23-
// logic does not handle byte operators
23+
// logic does not handle byte operators; similarly, data types that contain
24+
// pointers must not be handled here
2425
if(
2526
is_unbounded_array(expr.op().type()) ||
26-
is_unbounded_array(expr.value().type()))
27+
is_unbounded_array(expr.value().type()) ||
28+
has_subtype(expr.value().type(), ID_pointer, ns) ||
29+
has_subtype(expr.op0().type(), ID_pointer, ns))
2730
{
2831
return convert_bv(lower_byte_update(expr, ns));
2932
}

0 commit comments

Comments
 (0)