Skip to content

Commit de2d51e

Browse files
committed
Fix SharedFunctions.AssertionModule.exp_is_constraint
LAnd, LOr and LNot are constraint regardless of what's in their arguments (they don't need a != 0 added outside if something is non-constraint inside).
1 parent e355fab commit de2d51e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/cdomains/apron/sharedFunctions.apron.ml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -544,12 +544,10 @@ struct
544544
module Tracked = Tracked
545545
module Convert = Convert (V) (Bounds) (Arg) (Tracked)
546546

547-
let rec exp_is_constraint = function
548-
(* constraint *)
549-
| BinOp ((Lt | Gt | Le | Ge | Eq | Ne), _, _, _) -> true
550-
| BinOp ((LAnd | LOr), e1, e2, _) -> exp_is_constraint e1 && exp_is_constraint e2
551-
| UnOp (LNot,e,_) -> exp_is_constraint e
552-
(* expression *)
547+
(* TODO: deduplicate with BaseInvariant is_cmp *)
548+
let exp_is_constraint = function
549+
| UnOp (LNot, _, _)
550+
| BinOp ((Lt | Gt | Le | Ge | Eq | Ne | LAnd | LOr), _, _, _) -> true
553551
| _ -> false
554552

555553
(* TODO: move logic-handling assert_constraint from Apron back to here, after fixing affeq bot-bot join *)
@@ -562,6 +560,7 @@ struct
562560
else
563561
(* convert non-constraint expression, such that we assert(e != 0) *)
564562
BinOp (Ne, e, zero, intType)
563+
(* TODO: do this per non-constraint subexpression *)
565564
in
566565
assert_constraint ask d e' negate no_ov
567566

0 commit comments

Comments
 (0)