Module Offset.MakeLattice

Make offset Lattice from lattice indices.

Parameters

Signature

include Offset_intf.Printable with type idx = Idx.t
type idx = Idx.t

Type of indices in offset.

val is_definite : t -> bool

Whether offset has only definite integer indexing (and fields).

val contains_index : t -> bool

Whether offset contains any indexing.

val add_offset : t -> t -> t

add_offset o1 o2 appends o2 to o1.

val remove_offset : t -> t

Remove last indexing or field from offset.

val prefix : t -> t -> t option

prefix o1 o2 checks if o1 is a prefix of o2.

  • returns

    Some o if it is (such that add_offset o1 o = o2), None if it is not.

val map_indices : (idx -> idx) -> t -> t

Apply function to all indexing.

val to_cil : t -> GoblintCil.offset

Convert to CIL offset.

val to_exp : t -> GoblintCil.exp Offset_intf.offs

Convert to Goblint offset with GoblintCil.exp indices.

val to_cil_offset : t -> GoblintCil.offset

Version of to_cil which drops indices for ArrayDomain.

val cmp_zero_offset : t -> [ `MustZero | `MustNonzero | `MayZero ]

Compare offset to zero offset.

Zero indices and first fields of a struct are in the same physical memory location as the outer object.

  • returns

    `MustZero if definitely zero, `MustNonzero if definitely not zero, `MayZero if unknown.

val type_of : base:GoblintCil.typ -> t -> GoblintCil.typ

Type of the offset on the base type.

include Lattice.S with type t := t
include Lattice.PO with type t := t
include Printable.S with type t := t
val equal : t -> t -> bool
val hash : t -> int
val compare : t -> t -> int
val show : t -> string
val pretty : unit -> t -> Printable.Pretty.doc
val printXml : 'a BatInnerIO.output -> t -> unit
val name : unit -> string
val to_yojson : t -> Yojson.Safe.t
val tag : t -> int

Unique ID, given by HConsed, for context identification in witness

val arbitrary : unit -> t QCheck.arbitrary
val relift : t -> t
val leq : t -> t -> bool
val join : t -> t -> t
val meet : t -> t -> t
val widen : t -> t -> t

widen x y assumes leq x y. Solvers guarantee this by calling widen old (join old new).

val narrow : t -> t -> t
val pretty_diff : unit -> (t * t) -> Lattice.Pretty.doc

If leq x y = false, then pretty_diff () (x, y) should explain why.

val bot : unit -> t
val is_bot : t -> bool
val top : unit -> t
val is_top : t -> bool
val top_indices : t -> t

Change all indices to top indices.

val of_exp : GoblintCil.exp Offset_intf.offs -> t

Convert from Goblint offset with GoblintCil.exp indices.

val to_index : ?typ:GoblintCil.typ -> t -> idx

Physical memory offset in bytes of the entire offset. Used for semantic_equal.

  • parameter typ

    base type.

val semantic_equal : typ1:GoblintCil.typ -> t -> typ2:GoblintCil.typ -> t -> bool option

Check semantic equality of two offsets.

  • parameter typ1

    base type of first offset.

  • parameter typ2

    base type of second offset.

  • returns

    Some true if definitely equal, Some false if definitely not equal, None if unknown.