Skip to content

Commit 599ddcb

Browse files
committed
Hack to strip _Bool cast from assert refinement in base and relation
1 parent 40801d1 commit 599ddcb

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/analyses/baseInvariant.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,12 @@ struct
855855
inv_exp (Float ftv) exp st
856856

857857
let invariant man st exp tv =
858+
(* TODO: this cast should be supported generally somewhere above *)
859+
let exp =
860+
match exp with
861+
| CastE (TInt (IBool, _), exp) -> exp
862+
| exp -> exp
863+
in
858864
(* The computations that happen here are not computations that happen in the programs *)
859865
(* Any overflow during the forward evaluation will already have been flagged here *)
860866
GobRef.wrap AnalysisState.executing_speculative_computations true

src/cdomains/apron/sharedFunctions.apron.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,12 @@ struct
511511

512512
(** Assert any expression. *)
513513
let assert_inv ask d e negate no_ov =
514+
(* TODO: this cast should be supported generally somewhere above? *)
515+
let e =
516+
match e with
517+
| CastE (TInt (IBool, _), e) -> e
518+
| e -> e
519+
in
514520
let e' =
515521
if exp_is_constraint e then
516522
e

0 commit comments

Comments
 (0)