File tree 3 files changed +28
-3
lines changed
regression/goto-analyzer/variable-sensitivity-bit-field-intervals
3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change
1
+ struct bitfield_struct {
2
+ unsigned char byte ;
3
+ unsigned char bitfield :1 ;
4
+ };
5
+
6
+ extern struct bitfield_struct bs ;
7
+
8
+ void main (void )
9
+ {
10
+ bs .byte = 10 ;
11
+ bs .bitfield = 1 ;
12
+ __CPROVER_assert (bs .byte == 10 , "bs.byte==10" );
13
+ __CPROVER_assert (bs .bitfield == 1 , "bs.bitfield==1" );
14
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --function main --variable --structs --interval-values --verify
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ \[main\.assertion\.1\] .* bs\.byte==10: Success
7
+ \[main\.assertion\.2\] .* bs\.bitfield==1: Success
8
+ --
Original file line number Diff line number Diff line change @@ -1127,17 +1127,20 @@ bool constant_interval_exprt::is_float(const constant_interval_exprt &interval)
1127
1127
bool constant_interval_exprt::is_bitvector (const typet &t)
1128
1128
{
1129
1129
return t.id () == ID_bv || t.id () == ID_signedbv || t.id () == ID_unsignedbv
1130
- || t.id () == ID_c_bool;
1130
+ || t.id () == ID_c_bool
1131
+ || (t.id () == ID_c_bit_field && is_bitvector (t.subtype ()));
1131
1132
}
1132
1133
1133
1134
bool constant_interval_exprt::is_signed (const typet &t)
1134
1135
{
1135
- return t.id () == ID_signedbv;
1136
+ return t.id () == ID_signedbv
1137
+ || (t.id () == ID_c_bit_field && is_signed (t.subtype ()));
1136
1138
}
1137
1139
1138
1140
bool constant_interval_exprt::is_unsigned (const typet &t)
1139
1141
{
1140
- return t.id () == ID_bv || t.id () == ID_unsignedbv || t.id () == ID_c_bool;
1142
+ return t.id () == ID_bv || t.id () == ID_unsignedbv || t.id () == ID_c_bool
1143
+ || t.id () == ID_c_enum || (t.id () == ID_c_bit_field && is_unsigned (t.subtype ()));
1141
1144
}
1142
1145
1143
1146
bool constant_interval_exprt::is_signed (const constant_interval_exprt &interval)
You can’t perform that action at this time.
0 commit comments