Skip to content

Commit

Permalink
Detect query cycles in eval_exp
Browse files Browse the repository at this point in the history
  • Loading branch information
karoliineh committed Jan 9, 2024
1 parent c9ccbb6 commit bd5d65d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/analyses/base.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1107,12 +1107,12 @@ struct
Queries.Result.top q (* query cycle *)
else (
match q with
| EvalInt e -> query_evalint ~ctx st e (* mimic EvalInt query since eval_rv needs it *)
| EvalInt e -> query_evalint ~ctx:(ctx' (Queries.Set.add anyq asked)) st e (* mimic EvalInt query since eval_rv needs it *)
| _ -> Queries.Result.top q
)
and gs = function `Left _ -> `Lifted1 (Priv.G.top ()) | `Right _ -> `Lifted2 (VD.top ()) (* the expression is guaranteed to not contain globals *)
and ctx =
{ ask = (fun (type a) (q: a Queries.t) -> query Queries.Set.empty q)
and ctx' asked =
{ ask = (fun (type a) (q: a Queries.t) -> query asked q)
; emit = (fun _ -> failwith "Cannot \"emit\" in base eval_exp context.")
; node = MyCFG.dummy_node
; prev_node = MyCFG.dummy_node
Expand All @@ -1126,7 +1126,7 @@ struct
; sideg = (fun g d -> failwith "Base eval_exp trying to side effect.")
}
in
match eval_rv ~ctx st exp with
match eval_rv ~ctx:(ctx' Queries.Set.empty) st exp with
| Int x -> ValueDomain.ID.to_int x
| _ -> None

Expand Down

0 comments on commit bd5d65d

Please sign in to comment.