Skip to content
Snippets Groups Projects
Commit 663b963b authored by Loïc Correnson's avatar Loïc Correnson Committed by David Bühler
Browse files

[eva] fix sparse sets & unspecified seq.

parent b8c7e1d4
No related branches found
No related tags found
No related merge requests found
...@@ -97,17 +97,18 @@ let imax (exp : Exp.exp) (ival : Ival.t) : pred = ...@@ -97,17 +97,18 @@ let imax (exp : Exp.exp) (ival : Ival.t) : pred =
| None -> True | None -> True
| Some k -> Eval Exp.( exp <= of_integer k ) | Some k -> Eval Exp.( exp <= of_integer k )
let irange = function let sparse = function
| [_] | [] -> false | [] -> false
| [_] -> true
| x::xs -> | x::xs ->
let rec continuous x = function let rec continuous x = function
| [] -> true | [] -> true
| y::ys -> Z.equal (Z.succ x) y && continuous y ys | y::ys -> Z.equal (Z.succ x) y && continuous y ys
in continuous x xs in not @@ continuous x xs
let ival (exp : Exp.exp) (ival : Ival.t) : pred = let ival (exp : Exp.exp) (ival : Ival.t) : pred =
match Ival.project_small_set ival with match Ival.project_small_set ival with
| Some vs when not @@ irange vs -> | Some vs when sparse vs ->
List.fold_left (fun w v -> por w (iequal exp v)) False vs List.fold_left (fun w v -> por w (iequal exp v)) False vs
| _ -> pand (imin exp ival) (imax exp ival) | _ -> pand (imin exp ival) (imax exp ival)
...@@ -231,14 +232,14 @@ class evaluator request = ...@@ -231,14 +232,14 @@ class evaluator request =
method !vstmt_aux stmt = method !vstmt_aux stmt =
match stmt.skind with match stmt.skind with
(* Branching expressions *)
| If(e,_,_,_) | Switch(e,_,_,_) ->
self#visit_expr e ; SkipChildren
(* Instructions *) (* Instructions *)
| Instr _ | Return _ | Goto _ | Break _ | Continue _ | Instr _ | Return _ -> DoChildren
| UnspecifiedSequence _ -> DoChildren (* Branching expressions *)
(* Blocks *) | If(e,_,_,_) | Switch(e,_,_,_) -> self#visit_expr e ; SkipChildren
| Loop _ | Block _ | Throw _ | TryCatch _ | TryFinally _ | TryExcept _ (* Blocks & Jumps *)
| Goto _ | Break _ | Continue _
| Loop _ | Block _ | UnspecifiedSequence _
| Throw _ | TryCatch _ | TryFinally _ | TryExcept _
-> SkipChildren -> SkipChildren
end end
......
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