Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Towards fixing GobView search: Avoid truncation of very large integers #1092

Merged
merged 9 commits into from
Feb 7, 2024
8 changes: 6 additions & 2 deletions src/transform/expressionEvaluation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ struct

val global_variables =
file.globals
|> List.filter_map (function Cil.GVar (v, _, _) -> Some (v.vname, Cil.Fv v) | _ -> None)
|> List.filter_map (function
| Cil.GVar (v, _, _) -> Some (v.vname, Cil.Fv v)
| Cil.GFun (f, l) -> Some (f.svar.vname, Cil.Fv f.svar)
| Cil.GVarDecl (v, l) -> Some (v.vname, Cil.Fv v)
| _ -> None)
Comment on lines +63 to +67
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought for future: at some point this old expression evaluation should be switched from the odd Format-CIL parser (see goblint-cil issues) to the normal expression parser that's used for witness invariants. That avoids fixing the same issues twice.

At that point one might reconsider this being a transformation altogether, because it isn't. Simply using EvalInt or EvalValue queries directly from GobView should be possible.

val statements =
file.globals
|> List.filter_map (function Cil.GFun (f, _) -> Some f | _ -> None)
Expand All @@ -77,7 +81,7 @@ struct
(* Compute the available local variables *)
let local_variables =
match Hashtbl.find_option statements location with
| Some (function_definition, _) -> function_definition.slocals |> List.map (fun (v : Cil.varinfo) -> v.vname, Cil.Fv v)
| Some (fd, _) -> fd.slocals @ fd.sformals |> List.map (fun (v : Cil.varinfo) -> v.vname, Cil.Fv v)
| None -> []
in
(* Parse expression *)
Expand Down