Skip to content

Commit

Permalink
Merge pull request #615 from goblint/incremental/warn-about-duplicate…
Browse files Browse the repository at this point in the history
…-globals

Do not allow to collect globals with duplicate identifiers in map
  • Loading branch information
stilscher authored Mar 15, 2022
2 parents e1e558f + 33e70ea commit 39d7288
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/incremental/compareCIL.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ let compareCilFiles ?(eq=eq_glob) (oldAST: file) (newAST: file) =

let addGlobal map global =
try
GlobalMap.add (identifier_of_global global) global map
let gid = identifier_of_global global in
let gid_to_string gid = match gid.global_t with
| Var -> "Var " ^ gid.name
| Decl -> "Decl " ^ gid.name
| Fun -> "Fun " ^ gid.name
| _ -> raise (NoGlobalIdentifier global) in
if GlobalMap.mem gid map then failwith ("Duplicate global identifier: " ^ gid_to_string gid) else GlobalMap.add gid global map
with
Not_found -> map
in
Expand Down

0 comments on commit 39d7288

Please sign in to comment.