Skip to content

Commit 50aae48

Browse files
committed
byte_extract lowering over arrays: fix bits vs bytes error
The offset is computed in bits.
1 parent dab949a commit 50aae48

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/solvers/lowering/byte_operators.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ exprt lower_byte_extract(const byte_extract_exprt &src, const namespacet &ns)
246246
{
247247
plus_exprt new_offset(
248248
unpacked.offset(),
249-
from_integer(i * (*element_width), unpacked.offset().type()));
249+
from_integer(i * (*element_width) / 8, unpacked.offset().type()));
250250

251251
byte_extract_exprt tmp(unpacked);
252252
tmp.type()=subtype;

unit/solvers/lowering/byte_operators.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ SCENARIO("byte_extract_lowering", "[core][solvers][lowering][byte_extract]")
8888
// union_typet({{"compA", u32}, {"compB", u64}}),
8989
c_enum_typet(u16),
9090
c_enum_typet(unsignedbv_typet(128)),
91-
// array_typet(u8, size),
92-
// array_typet(s32, size),
93-
// array_typet(u64, size),
91+
array_typet(u8, size),
92+
array_typet(s32, size),
93+
array_typet(u64, size),
9494
unsignedbv_typet(24),
9595
unsignedbv_typet(128),
9696
signedbv_typet(24),

0 commit comments

Comments
 (0)