@@ -321,11 +321,10 @@ bvt boolbvt::convert_index(
321
321
std::size_t offset_int = numeric_cast_v<std::size_t >(offset);
322
322
return bvt (tmp.begin () + offset_int, tmp.begin () + offset_int + width);
323
323
}
324
- else if (
325
- array.id () == ID_member || array.id () == ID_index ||
326
- array.id () == ID_byte_extract_big_endian ||
327
- array.id () == ID_byte_extract_little_endian)
324
+ else if (array.id () == ID_member || array.id () == ID_index)
328
325
{
326
+ // out of bounds for the component, but not necessarily outside the bounds
327
+ // of the underlying object
329
328
object_descriptor_exprt o;
330
329
o.build (array, ns);
331
330
CHECK_RETURN (o.offset ().id () != ID_unknown);
@@ -344,6 +343,30 @@ bvt boolbvt::convert_index(
344
343
345
344
return convert_bv (be);
346
345
}
346
+ else if (
347
+ array.id () == ID_byte_extract_big_endian ||
348
+ array.id () == ID_byte_extract_little_endian)
349
+ {
350
+ const byte_extract_exprt &byte_extract_expr = to_byte_extract_expr (array);
351
+
352
+ const auto subtype_bytes_opt =
353
+ pointer_offset_size (array_type.subtype (), ns);
354
+ CHECK_RETURN (subtype_bytes_opt.has_value ());
355
+
356
+ // add offset to index
357
+ exprt new_offset = simplify_expr (
358
+ plus_exprt{
359
+ byte_extract_expr.offset (),
360
+ from_integer (
361
+ index * (*subtype_bytes_opt), byte_extract_expr.offset ().type ())},
362
+ ns);
363
+
364
+ byte_extract_exprt be = byte_extract_expr;
365
+ be.offset () = new_offset;
366
+ be.type () = array_type.subtype ();
367
+
368
+ return convert_bv (be);
369
+ }
347
370
else
348
371
{
349
372
// out of bounds
0 commit comments