@@ -327,10 +327,18 @@ struct
327
327
328
328
(* Remove elements, that would change if the given lval would change.*)
329
329
let remove_exp ask (e :exp ) (st :D.t ) : D.t =
330
+ let r =
330
331
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
331
335
332
336
let remove ask (e :lval ) (st :D.t ) : D.t =
337
+ let r =
333
338
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
334
342
(*
335
343
let not_in v xs = not (Exp.contains_var v xs) in
336
344
let remove_simple (v,offs) st =
@@ -402,11 +410,16 @@ struct
402
410
| None -> None
403
411
| Some st ->
404
412
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)
406
417
in
407
418
List. fold_right reachable es (Some (Queries.LS. empty () ))
408
419
409
420
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 =
410
423
if Queries.LS. is_top r then true else
411
424
let rec is_prefix x1 x2 =
412
425
match x1, x2 with
@@ -440,6 +453,9 @@ struct
440
453
| CastE (_ ,e ) -> reachable_from r e
441
454
| Question _ -> failwith " Logical operations should be compiled away by CIL."
442
455
| _ -> 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
443
459
444
460
(* Probably ok as is. *)
445
461
let body ctx f = ctx.local
@@ -489,13 +505,19 @@ struct
489
505
match reachables (Analyses. ask_of_ctx ctx) es with
490
506
| None -> D. top ()
491
507
| 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 =
493
510
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
495
516
in
496
517
D.B.fold remove_reachable2 es st
497
518
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 [] )
499
521
500
522
let unknown_fn ctx lval f args =
501
523
let args =
0 commit comments