Module Eval_exprs


module Eval_exprs: sig .. end
Detects if an expression can be considered as a lvalue even though it is hidden by a cast that does not change the lvalue. Raises exn if it is not an lvalue.

TODO: When the goal is to recognize the form (cast)l-value == expr, it would be better and more powerful to have chains of inverse functions

Type of the expression under the unop


exception Distinguishable_strings
exception Leaf
exception Not_an_exact_loc
exception Reduce_to_bottom
exception Offset_not_based_on_Null of Locations.Zone.t option * Locations.Location_Bytes.t
exception Cannot_find_lv
exception Too_linear

type cond = {
   exp : Cil_types.exp;
   positive : bool;
}
val check_comparable : Cil_types.binop ->
Locations.Location_Bytes.t ->
Locations.Location_Bytes.t ->
bool * Locations.Location_Bytes.t * Locations.Location_Bytes.t
val do_cast : with_alarms:CilE.warn_mode -> Cil_types.typ -> Cvalue.V.t -> Cvalue.V.t
val do_promotion : with_alarms:CilE.warn_mode ->
src_typ:Cil_types.typ ->
dest_type:Cil_types.typ -> Cvalue.V.t -> Cil_types.exp -> Cvalue.V.t
val handle_signed_overflow : with_alarms:CilE.warn_mode -> Cil_types.typ -> Cvalue.V.t -> Cvalue.V.t
val warn_lval_read : Cil_types.lval -> Locations.location -> Locations.Location_Bytes.z -> unit
val eval_binop_float : with_alarms:CilE.warn_mode ->
Cvalue.V.t -> Cil_types.binop -> Cvalue.V.t -> Cvalue.V.t
val eval_binop_int : with_alarms:CilE.warn_mode ->
?typ:Cil_types.typ ->
te1:Cil_types.typ ->
Locations.Location_Bytes.t ->
Cil_types.binop -> Locations.Location_Bytes.t -> Cvalue.V.t
val bitfield_size_lv : Cil_types.lval -> Int_Base.t
val bitfield_size_bf : Cil_types.lval -> Int_Base.t
val is_bitfield : Cil_types.lval -> ?sizelv:Int_Base.t -> ?sizebf:Int_Base.t -> unit -> bool
val lval_to_loc : with_alarms:CilE.warn_mode ->
Cvalue.Model.t -> Cil_types.lval -> Locations.location
val exp_lval_to_loc : Cvalue.Model.t -> Cil_types.exp -> Cil_types.lval * Locations.location
val lval_to_loc_deps_option : with_alarms:CilE.warn_mode ->
deps:Locations.Zone.t option ->
Cvalue.Model.t ->
reduce_valid_index:Kernel.SafeArrays.t ->
Cil_types.lval ->
Cvalue.Model.t * Locations.Zone.t option * Locations.location
val lval_to_loc_with_offset_deps_only : deps:Locations.Zone.t ->
Cvalue.Model.t ->
Cil_types.lval ->
with_alarms:CilE.warn_mode ->
Cvalue.Model.t * Locations.Zone.t option * Locations.location
val lval_to_loc_with_deps : deps:Locations.Zone.t ->
Cvalue.Model.t ->
Cil_types.lval ->
with_alarms:CilE.warn_mode ->
reduce_valid_index:Kernel.SafeArrays.t ->
Cvalue.Model.t * Locations.Zone.t option * Locations.location
val lval_to_loc_with_offset_deps_only_option : with_alarms:CilE.warn_mode ->
deps:Locations.Zone.t option ->
Cvalue.Model.t ->
Cil_types.lval ->
Cvalue.Model.t * Locations.Zone.t option * Locations.location

Detects if an expression can be considered as a lvalue even though it is hidden by a cast that does not change the lvalue. Raises exn if it is not an lvalue.

TODO: When the goal is to recognize the form (cast)l-value == expr, it would be better and more powerful to have chains of inverse functions

val pass_cast : with_alarms:CilE.warn_mode ->
Cvalue.Model.t -> exn -> Cil_types.typ -> Cil_types.exp -> unit
val find_lv : with_alarms:CilE.warn_mode ->
Cvalue.Model.t -> Cil_types.exp -> Cil_types.lval
val find_lv_plus : with_alarms:CilE.warn_mode ->
Cvalue.Model.t -> Cil_types.exp -> (Cil_types.lval * Ival.t) list
val base_to_loc : with_alarms:CilE.warn_mode ->
?deps:Locations.Zone.t ->
Cvalue.Model.t ->
Cil_types.lval ->
Cil_types.lhost ->
Ival.t -> Cvalue.Model.t * Locations.Zone.t option * Locations.location
val eval_expr : with_alarms:CilE.warn_mode -> Cvalue.Model.t -> Cil_types.exp -> Cvalue.V.t
val get_influential_vars : with_alarms:CilE.warn_mode ->
Cvalue.Model.t -> Cil_types.exp -> Locations.location list
val reduce_by_valid_expr : positive:bool ->
for_writing:bool -> Cil_types.exp -> Cvalue.Model.t -> Cvalue.Model.t
val reduce_by_valid_loc : positive:bool ->
for_writing:bool ->
Locations.location -> Cil_types.typ -> Cvalue.Model.t -> Cvalue.Model.t
val reduce_by_initialized_loc : with_alarms:'a ->
positive:bool ->
Cil_types.typ * Locations.Location_Bytes.t ->
Cvalue.Model.t -> Cvalue.Model.t
val eval_BinOp : with_alarms:CilE.warn_mode ->
Cil_types.exp ->
Locations.Zone.t option ->
Cvalue.Model.t -> Cvalue.Model.t * Locations.Zone.t option * Cvalue.V.t
val eval_expr_with_deps : with_alarms:CilE.warn_mode ->
Locations.Zone.t option ->
Cvalue.Model.t -> Cil_types.exp -> Locations.Zone.t option * Cvalue.V.t
val eval_expr_with_deps_state : with_alarms:CilE.warn_mode ->
Locations.Zone.t option ->
Cvalue.Model.t ->
Cil_types.exp ->
Cvalue.Model.t * Locations.Zone.t option * Locations.Location_Bytes.t
val eval_unop : with_alarms:CilE.warn_mode ->
Cvalue.V.t -> Cil_types.typ -> Cil_types.unop -> Cvalue.V.t
val eval_expr_with_deps_state_subdiv : with_alarms:CilE.warn_mode ->
Locations.Zone.t option ->
Cvalue.Model.t ->
Cil_types.exp ->
Cvalue.Model.t * Locations.Zone.t option * Locations.Location_Bytes.t
val cast_lval_bitfield : Cil_types.lval -> Abstract_interp.Int.t -> Cvalue.V.t -> Cvalue.V.t
val cast_lval_when_bitfield : Cil_types.lval ->
?sizelv:Int_Base.t -> ?sizebf:Int_Base.t -> Cvalue.V.t -> Cvalue.V.t
val eval_lval_using_main_memory : conflate_bottom:bool ->
with_alarms:CilE.warn_mode ->
Locations.Zone.t option ->
Cvalue.Model.t ->
Cil_types.lval -> Cvalue.Model.t * Locations.Zone.t option * Cvalue.V.t
val eval_lval : conflate_bottom:bool ->
with_alarms:CilE.warn_mode ->
Locations.Zone.t option ->
Cvalue.Model.t ->
Cil_types.lval -> Cvalue.Model.t * Locations.Zone.t option * Cvalue.V.t
val eval_offset : reduce_valid_index:Kernel.SafeArrays.t ->
with_alarms:CilE.warn_mode ->
Locations.Zone.t option ->
Cil_types.typ ->
Cvalue.Model.t ->
Cil_types.offset -> Cvalue.Model.t * Locations.Zone.t option * Ival.t
val topify_offset : with_alarms:CilE.warn_mode ->
Locations.Zone.t option ->
Cvalue.Model.t ->
Cvalue.V.t -> Cil_types.offset -> Locations.Zone.t option * Cvalue.V.t
val eval_as_exact_loc : with_alarms:CilE.warn_mode ->
Cvalue.Model.t ->
Cil_types.exp -> Locations.location * Cvalue.V.t * Cil_types.typ
val eval_symetric_int : bool -> Cil_types.binop -> Cvalue.V.t -> Cvalue.V.t -> Cvalue.V.t
val eval_symetric_float : bool -> Cil_types.binop -> Cvalue.V.t -> Cvalue.V.t -> Cvalue.V.t
val eval_antisymetric_int : typ_loc:'a ->
bool -> Cil_types.binop -> Cvalue.V.t -> Cvalue.V.z -> Cvalue.V.z
val eval_antisymetric_float : bool ->
typ_loc:Cil_types.typ ->
bool -> Cil_types.binop -> Cvalue.V.t -> Cvalue.V.t -> Cvalue.V.t

type eval_int_float = {
   eval_symetric : bool -> Cil_types.binop -> Cvalue.V.t -> Cvalue.V.t -> Cvalue.V.t;
   eval_antisymetric : typ_loc:Cil_types.typ ->
bool -> Cil_types.binop -> Cvalue.V.t -> Cvalue.V.t -> Cvalue.V.t
;
}
val eval_int : eval_int_float
val eval_float : bool -> eval_int_float
val eval_from_type : Cil_types.typ -> bool -> eval_int_float
val reduce_by_left_comparison : with_alarms:CilE.warn_mode ->
eval_int_float ->
bool ->
Cil_types.exp ->
Cil_types.binop ->
Cil_types.exp -> Cvalue.Model.t -> Cvalue.Model.t * Locations.location option
Reduce the state for comparisons of the form 'v Rel k', where v evaluates to a location, and k to some value
val reduce_by_comparison : with_alarms:CilE.warn_mode ->
eval_int_float ->
bool ->
Cil_types.exp ->
Cil_types.binop -> Cil_types.exp -> Cvalue.Model.t -> Cvalue.Model.t
Reduce the state for comparisons of the form 'v Rel k', 'k Rel v' or 'v = w'
val reduce_by_cond : with_alarms:CilE.warn_mode ->
Cvalue.Model.t -> cond -> Cvalue.Model.t
raises Reduce_to_bottom and never returns Cvalue.Model.bottom
val resolv_func_vinfo : with_alarms:CilE.warn_mode ->
Locations.Zone.t option ->
Cvalue.Model.t ->
Cil_types.exp -> Kernel_function.Hptset.t * Locations.Zone.t option