Skip to content

Commit

Permalink
Merge pull request #8318 from tautschnig/fix-8303
Browse files Browse the repository at this point in the history
Lower-byte-operators: bv_to_expr should support bool target type
  • Loading branch information
tautschnig authored Jun 11, 2024
2 parents 37511f3 + 7118b73 commit 8c229d7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/util/lower_byte_operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,14 @@ static exprt bv_to_expr(
else if(
can_cast_type<bitvector_typet>(target_type) ||
target_type.id() == ID_c_enum || target_type.id() == ID_c_enum_tag ||
target_type.id() == ID_string)
target_type.id() == ID_string ||
(target_type.id() == ID_bool &&
to_bitvector_type(bitvector_expr.type()).get_width() == 1))
{
return simplify_expr(
typecast_exprt::conditional_cast(bitvector_expr, target_type), ns);
}

if(target_type.id() == ID_struct)
else if(target_type.id() == ID_struct)
{
return bv_to_struct_expr(
bitvector_expr, to_struct_type(target_type), endianness_map, ns);
Expand Down

0 comments on commit 8c229d7

Please sign in to comment.