Skip to content

Commit 74f3649

Browse files
committed
Congruence sub: handle treatment of sub by computing congruence class with which to add.
1 parent 2fc8d3f commit 74f3649

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,13 @@ struct
319319
pretty res ;
320320
res
321321

322-
let sub ?(no_ov=false) ik x y = add ~no_ov ik x (neg ~no_ov ik y)
323-
322+
let sub ?(no_ov=false) ik x y =
323+
match y with
324+
| None -> raise (ArithmeticOnIntegerBot (Printf.sprintf "%s op %s" (show x) (show y)))
325+
| Some (c, m) ->
326+
let m = m -: c in
327+
let y = Some (c, m) in
328+
add ~no_ov ik x y
324329

325330
let sub ?no_ov ik x y =
326331
let res = sub ?no_ov ik x y in

0 commit comments

Comments
 (0)