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

Ignore synthetic locations in yaml witnesses #758

Merged
merged 2 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion goblint.opam
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dev-repo: "git+https://github.com/goblint/analyzer.git"
# on `dune build` goblint.opam will be generated from goblint.opam.template and dune-project
# also remember to generate/adjust goblint.opam.locked!
pin-depends: [
[ "goblint-cil.1.8.2" "git+https://github.com/goblint/cil.git#cc89da947d200575574de20867b56dbbbb2083bb" ]
[ "goblint-cil.1.8.2" "git+https://github.com/goblint/cil.git#9118601602d34edf53f73b35996abf2296c2d900" ]
# TODO: add back after release, only pinned for optimization (https://github.com/ocaml-ppx/ppx_deriving/pull/252)
[ "ppx_deriving.5.2.1" "git+https://github.com/ocaml-ppx/ppx_deriving.git#0a89b619f94cbbfc3b0fb3255ab4fe5bc77d32d6" ]
# quoter workaround reverted for release, so no pin needed
Expand Down
2 changes: 1 addition & 1 deletion goblint.opam.locked
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ version: "dev"
pin-depends: [
[
"goblint-cil.1.8.2"
"git+https://github.com/goblint/cil.git#cc89da947d200575574de20867b56dbbbb2083bb"
"git+https://github.com/goblint/cil.git#9118601602d34edf53f73b35996abf2296c2d900"
]
[
"apron.v0.9.13"
Expand Down
2 changes: 1 addition & 1 deletion goblint.opam.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# on `dune build` goblint.opam will be generated from goblint.opam.template and dune-project
# also remember to generate/adjust goblint.opam.locked!
pin-depends: [
[ "goblint-cil.1.8.2" "git+https://github.com/goblint/cil.git#cc89da947d200575574de20867b56dbbbb2083bb" ]
[ "goblint-cil.1.8.2" "git+https://github.com/goblint/cil.git#9118601602d34edf53f73b35996abf2296c2d900" ]
# TODO: add back after release, only pinned for optimization (https://github.com/ocaml-ppx/ppx_deriving/pull/252)
[ "ppx_deriving.5.2.1" "git+https://github.com/ocaml-ppx/ppx_deriving.git#0a89b619f94cbbfc3b0fb3255ab4fe5bc77d32d6" ]
# quoter workaround reverted for release, so no pin needed
Expand Down
2 changes: 1 addition & 1 deletion src/framework/cfgTools.ml
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ let getGlobalInits (file: file) : edges =
iterGlobals file f;
let initfun = emptyFunction "__goblint_dummy_init" in
(* order is not important since only compile-time constants can be assigned *)
({line = 0; file="initfun"; byte= 0; column = 0; endLine = -1; endByte = -1; endColumn = -1;}, Entry initfun) :: (BatHashtbl.keys inits |> BatList.of_enum)
({line = 0; file="initfun"; byte= 0; column = 0; endLine = -1; endByte = -1; endColumn = -1; synthetic = true}, Entry initfun) :: (BatHashtbl.keys inits |> BatList.of_enum)


let numGlobals file =
Expand Down
1 change: 1 addition & 0 deletions src/framework/control.ml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ struct
endLine = e;
endColumn = -1; (* not shown *)
endByte = 0; (* wrong, but not shown *)
synthetic = false;
}
in
(doc, Some loc)
Expand Down
2 changes: 1 addition & 1 deletion src/util/cilType.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct
| `Assoc l ->
begin match List.assoc_opt "file" l, List.assoc_opt "line" l, List.assoc_opt "column" l, List.assoc_opt "byte" l with
| Some (`String file), Some (`Int line), Some (`Int column), Some (`Int byte) ->
let loc = {file; line; column; byte; endLine = -1; endColumn = -1; endByte = -1} in
let loc = {file; line; column; byte; endLine = -1; endColumn = -1; endByte = -1; synthetic = false} in
begin match List.assoc_opt "endLine" l, List.assoc_opt "endColumn" l, List.assoc_opt "endByte" l with
| Some (`Int endLine), Some (`Int endColumn), Some (`Int endByte) ->
Result.Ok {loc with endLine; endColumn; endByte}
Expand Down
13 changes: 8 additions & 5 deletions src/witness/yamlWitness.ml
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ struct
let nh = join_contexts lh in

let yaml_entries = NH.fold (fun n local acc ->
let loc = Node.location n in
match n with
| Statement _ when WitnessInvariant.is_invariant_node n ->
| Statement _ when not loc.synthetic && WitnessInvariant.is_invariant_node n ->
let context: Invariant.context = {
scope=Node.find_fundec n;
i = -1;
Expand All @@ -143,7 +144,6 @@ struct
in
begin match Spec.D.invariant context local with
| Some inv ->
let loc = Node.location n in
let invs = WitnessUtil.InvariantExp.process_exp inv in
List.fold_left (fun acc inv ->
let location_function = (Node.find_fundec n).svar.vname in
Expand Down Expand Up @@ -206,9 +206,11 @@ struct
let file_loc_lvars: LvarS.t LocM.t FileH.t = FileH.create 100 in
LHT.iter (fun ((n, _) as lvar) _ ->
let loc = Node.location n in
FileH.modify_def LocM.empty loc.file (
LocM.modify_def LvarS.empty loc (LvarS.add lvar)
) file_loc_lvars
if not loc.synthetic then (
FileH.modify_def LocM.empty loc.file (
LocM.modify_def LvarS.empty loc (LvarS.add lvar)
) file_loc_lvars
)
) lh;

let global_vars = List.filter_map (function
Expand Down Expand Up @@ -266,6 +268,7 @@ struct
endLine = -1;
endColumn = -1;
endByte = -1;
synthetic = false;
}
in

Expand Down