Skip to content

Commit 81952d6

Browse files
committed
Simplify bitfield witness invariant for definite zeroes
1 parent 9cf7a47 commit 81952d6

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/cdomain/value/cdomains/int/bitfieldDomain.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ module BitfieldFunctor (Ints_t : IntOps.IntOps): Bitfield_SOverflow with type in
636636
Invariant.none
637637
else (
638638
let def0 = kintegerCilint ik (Ints_t.to_bigint def0) in
639-
Invariant.of_exp (BinOp (Eq, (BinOp (BAnd, UnOp (BNot, e, ik_type), def0, ik_type)), def0, intType))
639+
Invariant.of_exp (BinOp (Eq, (BinOp (BAnd, e, def0, ik_type)), kintegerCilint ik Z.zero, intType))
640640
)
641641
in
642642
let i2 =

tests/regression/56-witness/46-top-bool-invariant.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ bitfield only:
178178
line: 5
179179
column: 3
180180
function: main
181-
value: (~ x & (_Bool)1) == (_Bool)1
181+
value: (x & (_Bool)1) == (_Bool)0
182182
format: c_expression
183183
- invariant:
184184
type: location_invariant

tests/regression/83-bitfield/00-simple-demo.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
line: 28
165165
column: 3
166166
function: main
167-
value: (~ state & -11) == -11
167+
value: (state & -11) == 0
168168
format: c_expression
169169
- invariant:
170170
type: location_invariant
@@ -200,7 +200,7 @@
200200
line: 29
201201
column: 1
202202
function: main
203-
value: (~ state & -11) == -11
203+
value: (state & -11) == 0
204204
format: c_expression
205205
- invariant:
206206
type: location_invariant

tests/regression/witness/int.t/run.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
line: 12
3232
column: 5
3333
function: main
34-
value: (51 <= i && i <= 99) && (~ i & (-0x7FFFFFFF-1)) == (-0x7FFFFFFF-1)
34+
value: (51 <= i && i <= 99) && (i & (-0x7FFFFFFF-1)) == 0
3535
format: c_expression
3636
- invariant:
3737
type: location_invariant

0 commit comments

Comments
 (0)