Skip to content

Commit a6a3e1d

Browse files
committed
fix for boolbvt::convert_extractbit
Since 4ab7663 the constructor of equal_exprt enforces that the given expressions have the same type. This fixes an instance in boolbvt::convert_extractbit where a temporary and type-inconsistent equality was constructed, which has then triggered the precondition of the equal_exprt constructor.
1 parent ea235b5 commit a6a3e1d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/solvers/flattening/boolbv_extractbit.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ literalt boolbvt::convert_extractbit(const extractbit_exprt &expr)
5353
std::max(address_bits(src_bv_width), index_bv_width);
5454
unsignedbv_typet index_type(index_width);
5555

56-
equal_exprt equality(
57-
typecast_exprt::conditional_cast(index, index_type), exprt());
56+
const auto index_casted =
57+
typecast_exprt::conditional_cast(index, index_type);
5858

5959
if(prop.has_set_to())
6060
{
@@ -64,7 +64,7 @@ literalt boolbvt::convert_extractbit(const extractbit_exprt &expr)
6464
// add implications
6565
for(std::size_t i = 0; i < src_bv.size(); i++)
6666
{
67-
equality.rhs()=from_integer(i, index_type);
67+
equal_exprt equality(index_casted, from_integer(i, index_type));
6868
literalt equal = prop.lequal(literal, src_bv[i]);
6969
prop.l_set_to_true(prop.limplies(convert(equality), equal));
7070
}
@@ -77,7 +77,7 @@ literalt boolbvt::convert_extractbit(const extractbit_exprt &expr)
7777

7878
for(std::size_t i = 0; i < src_bv.size(); i++)
7979
{
80-
equality.rhs()=from_integer(i, index_type);
80+
equal_exprt equality(index_casted, from_integer(i, index_type));
8181
literal = prop.lselect(convert(equality), src_bv[i], literal);
8282
}
8383

0 commit comments

Comments
 (0)