Skip to content
Snippets Groups Projects
Commit 6b6d9b36 authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[wp] Post/Exit state unreachable

parent a8f203f2
No related branches found
No related tags found
No related merge requests found
...@@ -196,6 +196,20 @@ end ...@@ -196,6 +196,20 @@ end
(* --- Main Collection Pass --- *) (* --- Main Collection Pass --- *)
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
let post_props_ids ~bhv ~prop tk (b: CfgAnnot.behavior) =
let assigns, posts = match tk with
| Cil_types.Exits -> b.bhv_exit_assigns, b.bhv_exits
| _ -> b.bhv_post_assigns, b.bhv_ensures
in
let ps = List.filter (selected ~prop ~bhv) @@ List.map fst posts in
match assigns with
| WpPropId.AssignsLocations(id, _) -> Bag.list (id :: ps)
| _ -> Bag.list ps
let dead_posts ~bhv ~prop tk behaviors =
let collect_dead b = Bag.concat (post_props_ids ~bhv ~prop tk b) in
List.fold_right collect_dead behaviors Bag.empty
let loop_contract_pids kf stmt = let loop_contract_pids kf stmt =
match stmt.Cil_types.skind with match stmt.Cil_types.skind with
| Loop _ -> | Loop _ ->
...@@ -262,9 +276,21 @@ let compile Key.{ kf ; smoking ; bhv ; prop } = ...@@ -262,9 +276,21 @@ let compile Key.{ kf ; smoking ; bhv ; prop } =
infos.calls <- Fset.union fs infos.calls ; infos.calls <- Fset.union fs infos.calls ;
end end
) cfg.stmt_table ; ) cfg.stmt_table ;
let exits = not @@ Fset.is_empty infos.calls in
let mapper fb = CfgAnnot.get_behavior kf ~exits ~active:bhv fb in
let behaviors = List.map mapper behaviors in
if not exits then
infos.doomed <-
Bag.concat infos.doomed (dead_posts ~bhv ~prop Exits behaviors) ;
if unreachable infos cfg.return_point then
infos.doomed <-
Bag.concat infos.doomed (dead_posts ~bhv ~prop Normal behaviors) ;
end body ; end body ;
(* Doomed *) (* Doomed *)
Bag.iter WpAnnot.set_unreachable infos.doomed ; Bag.iter
(fun p -> if WpPropId.filter_status p then WpAnnot.set_unreachable p)
infos.doomed ;
(* Collected Infos *) (* Collected Infos *)
infos infos
......
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