Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions regression/cbmc/smt2-bitfield-trace/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
unsigned nondet_u(void);
struct S
{
unsigned bf : 3;
unsigned other;
};
int main(void)
{
struct S s;
s.bf = nondet_u();
s.other = 7;
__CPROVER_assume(s.bf == 5);
__CPROVER_assert(0, "show trace");
return 0;
}
10 changes: 10 additions & 0 deletions regression/cbmc/smt2-bitfield-trace/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE no-new-smt
main.c
--trace --z3
^EXIT=10$
^SIGNAL=0$
^ s\.bf=5u
^VERIFICATION FAILED$
--
^warning: ignoring
assignment removed
10 changes: 10 additions & 0 deletions src/solvers/smt2/smt2_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,16 @@ exprt smt2_convt::parse_rec(const irept &src, const typet &type)
{
return parse_literal(src, type);
}
else if(type.id() == ID_c_bit_field)
{
// bit-fields are bit vectors of their width: parse them using the
// corresponding integer type
exprt result = parse_rec(
src, c_bit_field_replacement_type(to_c_bit_field_type(type), ns));
if(result.is_not_nil())
result.type() = type;
return result;
}
else if(type.id()==ID_bool)
{
if(src.id()==ID_1 || src.id()==ID_true)
Expand Down
Loading