Skip to content
Snippets Groups Projects
Commit 56ff49f9 authored by Valentin Perrelle's avatar Valentin Perrelle Committed by David Bühler
Browse files

[Eva] multidim: improve precision when an expression is not in the valuation

parent 47820e55
No related branches found
No related tags found
No related merge requests found
...@@ -628,15 +628,16 @@ struct ...@@ -628,15 +628,16 @@ struct
(* Eva Transfer *) (* Eva Transfer *)
let make_oracle valuation : Cil_types.exp -> value = fun exp -> let valuation_to_oracle state valuation : Cil_types.exp -> value = fun exp ->
let multidim_oracle = mk_oracle state in
match valuation.Abstract_domain.find exp with match valuation.Abstract_domain.find exp with
| `Top -> Value.top | `Top -> multidim_oracle exp
| `Value {value={v=`Bottom}} -> Value.bottom | `Value {value={v=`Bottom}} -> Value.bottom
| `Value {value={v=`Value value}} -> value | `Value {value={v=`Value value}} -> value
let assume_exp valuation expr record state' = let assume_exp valuation expr record state' =
state' >>- fun state -> state' >>- fun state ->
let oracle = make_oracle valuation in let oracle = valuation_to_oracle state valuation in
match expr.enode with match expr.enode with
| Lval lv -> | Lval lv ->
let value = Value_or_Uninitialized.from_flagged record.value in let value = Value_or_Uninitialized.from_flagged record.value in
...@@ -726,9 +727,9 @@ struct ...@@ -726,9 +727,9 @@ struct
overwrite ~oracle state dst src overwrite ~oracle state dst src
let assign _kinstr left expr assigned_value valuation state = let assign _kinstr left expr assigned_value valuation state =
let oracle = valuation_to_oracle state valuation in
let state = update_array_segmentation left.lval (Some expr) state in let state = update_array_segmentation left.lval (Some expr) state in
assume_valuation valuation state >>-: fun state -> assume_valuation valuation state >>-: fun state ->
let oracle = make_oracle valuation in
assign_lval left.lval assigned_value oracle state assign_lval left.lval assigned_value oracle state
let assume _stmt _expr _pos valuation state = let assume _stmt _expr _pos valuation state =
...@@ -739,7 +740,7 @@ struct ...@@ -739,7 +740,7 @@ struct
then then
Self.abort ~current:true Self.abort ~current:true
"The multidim domain does not support recursive calls yet"; "The multidim domain does not support recursive calls yet";
let oracle = make_oracle valuation in let oracle = valuation_to_oracle state valuation in
let bind state arg = let bind state arg =
state >>-: assign_lval (Cil.var arg.formal) arg.avalue oracle state >>-: assign_lval (Cil.var arg.formal) arg.avalue oracle
in in
...@@ -756,7 +757,7 @@ struct ...@@ -756,7 +757,7 @@ struct
let show_expr valuation state fmt expr = let show_expr valuation state fmt expr =
match expr.enode with match expr.enode with
| Lval lval | StartOf lval -> | Lval lval | StartOf lval ->
let oracle = make_oracle valuation in let oracle = valuation_to_oracle state valuation in
begin match Location.of_lval oracle lval with begin match Location.of_lval oracle lval with
| `Top -> Format.fprintf fmt "%s" (Unicode.top_string ()) | `Top -> Format.fprintf fmt "%s" (Unicode.top_string ())
| `Value loc -> | `Value loc ->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment