Skip to content

Commit 8beda26

Browse files
committed
Byte-extract lowering: do not support PODs with non-constant width
This case shouldn't actually occur, and is thus now an invariant rather than half-supporting it and otherwise failing with an exception. This is a first step towards getting rid of the remaining exceptions in byte-operator lowering.
1 parent dc139cd commit 8beda26

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/solvers/lowering/byte_operators.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -746,14 +746,8 @@ static exprt unpack_rec(
746746
// a basic type; we turn that into extractbits while considering
747747
// endianness
748748
auto bits_opt = pointer_offset_bits(src.type(), ns);
749-
mp_integer bits;
750-
751-
if(bits_opt.has_value())
752-
bits = *bits_opt;
753-
else if(max_bytes.has_value())
754-
bits = *max_bytes * 8;
755-
else
756-
throw non_constant_widtht(src, nil_exprt());
749+
DATA_INVARIANT(bits_opt.has_value(), "basic type should have a fixed size");
750+
mp_integer bits = *bits_opt;
757751

758752
exprt::operandst byte_operands;
759753
for(mp_integer i=0; i<bits; i+=8)

0 commit comments

Comments
 (0)