Skip to content

Commit 2ce63a1

Browse files
committed
Stuff
1 parent 5aa6118 commit 2ce63a1

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

src/analyses/varEq.ml

+26-4
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,18 @@ struct
327327

328328
(* Remove elements, that would change if the given lval would change.*)
329329
let remove_exp ask (e:exp) (st:D.t) : D.t =
330+
let r =
330331
D.filter (fun x -> not (may_change ask e x)) st
332+
in
333+
ignore (Pretty.printf "remove_exp %a %a = %a\n" CilType.Exp.pretty e D.pretty st D.pretty r);
334+
r
331335

332336
let remove ask (e:lval) (st:D.t) : D.t =
337+
let r =
333338
remove_exp ask (mkAddrOf e) st
339+
in
340+
ignore (Pretty.printf "remove %a %a = %a\n" CilType.Lval.pretty e D.pretty st D.pretty r);
341+
r
334342
(*
335343
let not_in v xs = not (Exp.contains_var v xs) in
336344
let remove_simple (v,offs) st =
@@ -402,11 +410,16 @@ struct
402410
| None -> None
403411
| Some st ->
404412
let vs = ask.f (Queries.ReachableFrom e) in
405-
Some (Queries.LS.join vs st)
413+
if Queries.LS.is_top vs then
414+
None
415+
else
416+
Some (Queries.LS.join vs st)
406417
in
407418
List.fold_right reachable es (Some (Queries.LS.empty ()))
408419

409420
let rec reachable_from (r:Queries.LS.t) e =
421+
ignore (Pretty.printf "reachable_from %a %a\n" Queries.LS.pretty r CilType.Exp.pretty e);
422+
let r2 =
410423
if Queries.LS.is_top r then true else
411424
let rec is_prefix x1 x2 =
412425
match x1, x2 with
@@ -440,6 +453,9 @@ struct
440453
| CastE (_,e) -> reachable_from r e
441454
| Question _ -> failwith "Logical operations should be compiled away by CIL."
442455
| _ -> failwith "Unmatched pattern."
456+
in
457+
ignore (Pretty.printf "reachable_from %a %a = %B\n" Queries.LS.pretty r CilType.Exp.pretty e r2);
458+
r2
443459

444460
(* Probably ok as is. *)
445461
let body ctx f = ctx.local
@@ -489,13 +505,19 @@ struct
489505
match reachables (Analyses.ask_of_ctx ctx) es with
490506
| None -> D.top ()
491507
| Some rs ->
492-
let remove_reachable1 es st =
508+
ignore (Pretty.printf "reachables %a: %a\n" (d_list ", " CilType.Exp.pretty) es Queries.LS.pretty rs);
509+
(* let remove_reachable1 es st =
493510
let remove_reachable2 e st =
494-
if reachable_from rs e && not (isConstant e) then remove_exp (Analyses.ask_of_ctx ctx) e st else st
511+
ignore (Pretty.printf "remove_reachable2 %a %a\n" CilType.Exp.pretty e D.pretty st);
512+
if reachable_from rs e && not (isConstant e) then
513+
remove_exp (Analyses.ask_of_ctx ctx) e st
514+
else
515+
st
495516
in
496517
D.B.fold remove_reachable2 es st
497518
in
498-
D.fold remove_reachable1 ctx.local ctx.local
519+
D.fold remove_reachable1 ctx.local ctx.local *)
520+
List.fold_left (fun st e -> remove_exp (Analyses.ask_of_ctx ctx) e st) ctx.local (Queries.LS.fold (fun lval acc -> mkAddrOf (Lval.CilLval.to_lval lval) :: acc) rs [])
499521

500522
let unknown_fn ctx lval f args =
501523
let args =

0 commit comments

Comments
 (0)