Skip to content

Commit 5977857

Browse files
committed
byte_extract lowering over arrays: fix bits vs bytes error
The offset is computed in bits.
1 parent 02ce47f commit 5977857

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
@@ -116,9 +116,9 @@ SCENARIO("byte_extract_lowering", "[core][solvers][lowering][byte_extract]")
116116
// union_typet({{"compA", u32}, {"compB", u64}}),
117117
c_enum_typet(u16),
118118
c_enum_typet(unsignedbv_typet(128)),
119-
// array_typet(u8, size),
120-
// array_typet(s32, size),
121-
// array_typet(u64, size),
119+
array_typet(u8, size),
120+
array_typet(s32, size),
121+
array_typet(u64, size),
122122
unsignedbv_typet(24),
123123
unsignedbv_typet(128),
124124
signedbv_typet(24),

0 commit comments

Comments
 (0)