Skip to content

Commit 6c9eff3

Browse files
committed
Restore top_overflow in def_exc for operations like add
1 parent d4bf659 commit 6c9eff3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ struct
8080
type int_t = Z.t
8181
let name () = "def_exc"
8282

83+
84+
let top_range = R.of_interval range_ikind (-99L, 99L) (* Since there is no top ikind we use a range that includes both ILongLong [-63,63] and IULongLong [0,64]. Only needed for intermediate range computation on longs. Correct range is set by cast. *)
85+
let top_overflow () = `Excluded (S.empty (), top_range)
8386
let bot () = `Bot
8487
let top_of ik = `Excluded (S.empty (), size ik)
8588
let bot_of ik = bot ()
@@ -346,10 +349,10 @@ struct
346349
(* We don't bother with exclusion sets: *)
347350
| `Excluded _, `Definite _
348351
| `Definite _, `Excluded _
349-
| `Excluded _, `Excluded _ -> top_of ik
352+
| `Excluded _, `Excluded _ -> top_overflow ()
350353
(* The good case: *)
351354
| `Definite x, `Definite y ->
352-
(try `Definite (f x y) with | Division_by_zero -> top_of ik)
355+
(try `Definite (f x y) with | Division_by_zero -> top_overflow ())
353356
| `Bot, `Bot -> `Bot
354357
| _ ->
355358
(* If only one of them is bottom, we raise an exception that eval_rv will catch *)
@@ -362,7 +365,7 @@ struct
362365
norm ik @@
363366
match x,y with
364367
(* If both are exclusion sets, there isn't anything we can do: *)
365-
| `Excluded _, `Excluded _ -> top_of ik
368+
| `Excluded _, `Excluded _ -> top_overflow ()
366369
(* A definite value should be applied to all members of the exclusion set *)
367370
| `Definite x, `Excluded (s,r) -> def_exc f x s r
368371
(* Same thing here, but we should flip the operator to map it properly *)

0 commit comments

Comments
 (0)