Skip to content

Commit c5c752e

Browse files
committed
Document def_exc and enums exclusion bit range assumption
1 parent f2500d5 commit c5c752e

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct
7373

7474

7575
type t = [
76-
| `Excluded of S.t * R.t
76+
| `Excluded of S.t * R.t (** Bit range always includes 0. *)
7777
| `Definite of Z.t
7878
| `Bot
7979
] [@@deriving eq, ord, hash]

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ module Enums : S with type int_t = Z.t = struct
1111
let range_ikind = Cil.IInt
1212
let size t = R.of_interval range_ikind (let a,b = Size.bits_i64 t in Int64.neg a,b)
1313

14-
type t = Inc of BISet.t | Exc of BISet.t * R.t [@@deriving eq, ord, hash] (* inclusion/exclusion set *)
14+
type t =
15+
| Inc of BISet.t (* Inclusion set. *)
16+
| Exc of BISet.t * R.t (** Exclusion set. Bit range always includes 0. *)
17+
[@@deriving eq, ord, hash]
1518

1619
type int_t = Z.t
1720
let name () = "enums"

src/cdomain/value/cdomains/intDomain0.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ module Size = struct (* size in bits as int, range as int64 *)
464464
if M.tracing then M.tracel "cast" "Cast %a to range [%a, %a] (%a) = %a (%s in int64)" GobZ.pretty x GobZ.pretty a GobZ.pretty b GobZ.pretty c GobZ.pretty y (if is_int64_big_int y then "fits" else "does not fit");
465465
y
466466

467+
(** @return Bit range always includes 0. *)
467468
let min_range_sign_agnostic x =
468469
let size ik =
469470
let a,b = bits_i64 ik in

0 commit comments

Comments
 (0)