Skip to content

Commit e9ffa30

Browse files
committed
simplify/byte_extract bugfixes
1 parent 700c378 commit e9ffa30

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/util/simplify_expr.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,11 @@ exprt simplify_exprt::bits2expr(
16761676
return constant_exprt(tmp, type);
16771677
}
16781678
else if(type.id()==ID_c_enum)
1679-
return constant_exprt(bits, type);
1679+
{
1680+
exprt val=bits2expr(bits, type.subtype(), little_endian);
1681+
val.type()=type;
1682+
return val;
1683+
}
16801684
else if(type.id()==ID_c_enum_tag)
16811685
return
16821686
bits2expr(
@@ -1925,10 +1929,8 @@ bool simplify_exprt::simplify_byte_extract(byte_extract_exprt &expr)
19251929

19261930
// no proper simplification for expr.type()==void
19271931
// or types of unknown size
1928-
if(expr.type().id()==ID_empty ||
1929-
el_size<0)
1932+
if(el_size<=0)
19301933
return true;
1931-
assert(el_size>0);
19321934

19331935
if(expr.op().id()==ID_array_of &&
19341936
expr.op().op0().id()==ID_constant)

0 commit comments

Comments
 (0)