@@ -1165,6 +1165,27 @@ static smt_termt convert_expr_to_smt(
1165
1165
return extract_op;
1166
1166
}
1167
1167
1168
+ static smt_termt convert_expr_to_smt (
1169
+ const pointer_offset_exprt &pointer_offset,
1170
+ const sub_expression_mapt &converted)
1171
+ {
1172
+ const auto type =
1173
+ type_try_dynamic_cast<bitvector_typet>(pointer_offset.type ());
1174
+ INVARIANT (type, " Pointer offset should have a bitvector-based type." );
1175
+ const auto converted_expr = converted.at (pointer_offset.pointer ());
1176
+ const std::size_t width = type->get_width ();
1177
+ std::size_t offset_bits = width - config.bv_encoding .object_bits ;
1178
+ if (offset_bits > width)
1179
+ offset_bits = width;
1180
+ const auto extract_op =
1181
+ smt_bit_vector_theoryt::extract (offset_bits - 1 , 0 )(converted_expr);
1182
+ if (width > offset_bits)
1183
+ {
1184
+ return smt_bit_vector_theoryt::zero_extend (width - offset_bits)(extract_op);
1185
+ }
1186
+ return extract_op;
1187
+ }
1188
+
1168
1189
static smt_termt convert_expr_to_smt (
1169
1190
const shl_overflow_exprt &shl_overflow,
1170
1191
const sub_expression_mapt &converted)
@@ -1456,11 +1477,12 @@ static smt_termt dispatch_expr_to_smt_conversion(
1456
1477
{
1457
1478
return convert_expr_to_smt (*member_extraction, converted);
1458
1479
}
1459
- #if 0
1460
- else if(expr.id()==ID_pointer_offset)
1480
+ else if (
1481
+ const auto pointer_offset =
1482
+ expr_try_dynamic_cast<pointer_offset_exprt>(expr))
1461
1483
{
1484
+ return convert_expr_to_smt (*pointer_offset, converted);
1462
1485
}
1463
- #endif
1464
1486
else if (
1465
1487
const auto pointer_object =
1466
1488
expr_try_dynamic_cast<pointer_object_exprt>(expr))
0 commit comments