Skip to content
Snippets Groups Projects
Commit 5bd9c8c9 authored by David Bühler's avatar David Bühler
Browse files

[Eva] Fixes simple_memory: do not fail on top locations.

Catches Abstract_interp.Error_Top when folding a location.

When updating the state from a valuation, do not reduce the value for a location
that is not a singleton: the state can instead be left unchanged, while the
binding of an imprecise location cannot reduce the state.
parent ceb9a93e
No related branches found
No related tags found
No related merge requests found
...@@ -141,7 +141,8 @@ module Make_Memory (Value: Value) = struct ...@@ -141,7 +141,8 @@ module Make_Memory (Value: Value) = struct
else add b v state else add b v state
| Imprecise -> remove b state | Imprecise -> remove b state
in in
Location_Bits.fold_topset_ok aux_base loc state try Location_Bits.fold_topset_ok aux_base loc state
with Abstract_interp.Error_Top -> empty
let remove_variables vars state = let remove_variables vars state =
let remove_variable state v = remove (Base.of_varinfo v) state in let remove_variable state v = remove (Base.of_varinfo v) state in
...@@ -161,9 +162,11 @@ module Make_Memory (Value: Value) = struct ...@@ -161,9 +162,11 @@ module Make_Memory (Value: Value) = struct
| Precise -> Bottom.join Value.join r (`Value (find_or_top b state)) | Precise -> Bottom.join Value.join r (`Value (find_or_top b state))
| Imprecise -> `Value Value.top | Imprecise -> `Value Value.top
in in
match Location_Bits.fold_topset_ok aux_base loc `Bottom with try
| `Bottom -> Value.top (* does not happen if the location is not empty *) match Location_Bits.fold_topset_ok aux_base loc `Bottom with
| `Value v -> v | `Bottom -> Value.top (* does not happen if the location is not empty *)
| `Value v -> v
with Abstract_interp.Error_Top -> Value.top
end end
...@@ -234,7 +237,10 @@ module Make_Internal (Info: sig val name: string end) (Value: Value) = struct ...@@ -234,7 +237,10 @@ module Make_Internal (Info: sig val name: string end) (Value: Value) = struct
| Lval lv -> begin | Lval lv -> begin
match Valuation.find_loc valuation lv with match Valuation.find_loc valuation lv with
| `Top -> state | `Top -> state
| `Value {loc; typ} -> bind_loc loc typ record.value.v state | `Value {loc; typ} ->
if Precise_locs.cardinal_zero_or_one loc
then bind_loc loc typ record.value.v state
else state
end end
| _ -> state | _ -> state
......
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