Skip to content

Commit 90b1fc1

Browse files
committed
Modular: Check whether caller is modular when computing reachable set from globals.
1 parent adae595 commit 90b1fc1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/analyses/base.ml

+9-4
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,9 @@ struct
13791379
JmpBufDomain.JmpBufSet.top ()
13801380
end
13811381
| Q.EvalInt e ->
1382-
query_evalint (Analyses.ask_of_ctx ctx) ctx.global ctx.local e
1382+
let r = query_evalint (Analyses.ask_of_ctx ctx) ctx.global ctx.local e in
1383+
M.tracel "eval_int_base" "%a yields %a\n" CilType.Exp.pretty e Queries.ID.pretty r;
1384+
r
13831385
| Q.EvalMutexAttr e -> begin
13841386
let e:exp = Lval (Cil.mkMem ~addr:e ~off:NoOffset) in
13851387
match eval_rv (Analyses.ask_of_ctx ctx) ctx.global ctx.local e with
@@ -2994,9 +2996,11 @@ struct
29942996
) dir_reachable_abs;
29952997
) combined;
29962998

2999+
let caller_is_modular = ctx.ask IsModular in
3000+
29973001
(* Add globals *)
29983002
let add_global_to_queue (g: varinfo) =
2999-
let a_c = Addr.of_var ~is_modular:false g in
3003+
let a_c = Addr.of_var ~is_modular:caller_is_modular g in
30003004
let a = Addr.of_var ~is_modular:true g in
30013005

30023006
Queue.add (a_c, a) queue;
@@ -3120,8 +3124,9 @@ struct
31203124
let callee_globals = UsedGlobals.get_used_globals f_ask in
31213125
let params = f.sformals in
31223126
let reachable = collect_targets_with_graph ctx write_graph args params callee_globals (AD.bot ()) in
3123-
let value = ModularUtil.ValueDomainExtension.map_back value ~reachable in
3124-
value
3127+
let new_value = ModularUtil.ValueDomainExtension.map_back value ~reachable in
3128+
M.tracel "translate_callee_value_back" "reachable: %a\nGraph: %a\nOriginal_value: %a\n new_value:%a\n" AD.pretty reachable Graph.pretty write_graph VD.pretty value VD.pretty new_value;
3129+
new_value
31253130

31263131
let combine_assign ctx (lval: lval option) fexp (f: fundec) (args: exp list) fc (after: D.t) (f_ask: Q.ask) : D.t =
31273132
let combine_one (st: D.t) (fun_st: D.t) =

0 commit comments

Comments
 (0)