You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ifM.tracing thenM.tracel "combine""apron enter newd: %a\n"AD.pretty new_apr;
@@ -340,8 +362,8 @@ struct
340
362
AD.remove_vars_with new_fun_apr arg_vars; (* fine to remove arg vars that also exist in caller because unify from new_apr adds them back with proper constraints *)
341
363
let new_apr =AD.keep_filter st.apr (funvar ->
342
364
matchV.find_metadata var with
343
-
|SomeLocalwhennot (pass_to_callee fundec any_local_reachable var) -> true(* keep caller locals, provided they were not passed to the function *)
344
-
|SomeArg -> true(* keep caller args *)
365
+
|Some(Local_)whennot (pass_to_callee fundec any_local_reachable var) -> true(* keep caller locals, provided they were not passed to the function *)
366
+
|Some(Arg_) -> true(* keep caller args *)
345
367
|_ -> false(* remove everything else (globals, global privs, reachable things from the caller) *)
346
368
)
347
369
in
@@ -392,9 +414,8 @@ struct
392
414
match reachables ask es with
393
415
|None ->
394
416
(* top reachable, so try to invalidate everything *)
395
-
let fd =Node.find_fundec ctx.node in
396
417
AD.vars st.apr
397
-
|>List.filter_map (V.to_cil_varinfo fd)
418
+
|>List.filter_map V.to_cil_varinfo
398
419
|>List.map Cil.var
399
420
|Somers ->
400
421
Queries.LS.elements rs
@@ -480,25 +501,50 @@ struct
480
501
letquery_invariantctxcontext=
481
502
let keep_local =GobConfig.get_bool "ana.apron.invariant.local"in
482
503
let keep_global =GobConfig.get_bool "ana.apron.invariant.global"in
483
-
484
-
let apr = ctx.local.apr in
485
-
(* filter variables *)
486
-
letvar_filterv=matchV.find_metadata v with
487
-
|Some (Global _) -> keep_global
488
-
|SomeLocal -> keep_local
489
-
|_ -> false
490
-
in
491
-
let apr =AD.keep_filter apr var_filter in
492
-
493
504
let one_var =GobConfig.get_bool "ana.apron.invariant.one-var"in
505
+
506
+
let ask =Analyses.ask_of_ctx ctx in
494
507
let scope =Node.find_fundec ctx.node in
495
508
509
+
let (apr, e_inv) =
510
+
ifThreadFlag.is_multi ask then (
511
+
let priv_vars =
512
+
if keep_global then
513
+
Priv.invariant_vars ask ctx.global ctx.local
514
+
else
515
+
[](* avoid pointless queries *)
516
+
in
517
+
let (apr, e_inv, v_ins_inv) = read_globals_to_locals_inv ask ctx.global ctx.local priv_vars in
518
+
(* filter variables *)
519
+
letvar_filterv=matchV.find_metadata v with
520
+
|Some (Local v) ->
521
+
ifVH.mem v_ins_inv v then
522
+
keep_global
523
+
else
524
+
keep_local
525
+
|_ -> false
526
+
in
527
+
let apr =AD.keep_filter apr var_filter in
528
+
(apr, e_inv)
529
+
)
530
+
else (
531
+
(* filter variables *)
532
+
letvar_filterv=matchV.find_metadata v with
533
+
|Some (Global _) -> keep_global
534
+
|Some (Local _) -> keep_local
535
+
|_ -> false
536
+
in
537
+
let apr =AD.keep_filter ctx.local.apr var_filter in
538
+
(apr, Fun.id)
539
+
)
540
+
in
496
541
AD.invariant ~scope apr
497
542
|>List.enum
498
543
|>Enum.filter_map (fun (lincons1: Lincons1.t) ->
499
544
(* filter one-vars *)
500
545
if one_var ||Apron.Linexpr0.get_size lincons1.lincons0.linexpr0 >=2then
501
-
CilOfApron.cil_exp_of_lincons1 scope lincons1
546
+
CilOfApron.cil_exp_of_lincons1 lincons1
547
+
|>Option.map e_inv
502
548
|>Option.filter (funexp -> not (InvariantCil.exp_contains_tmp exp) &&InvariantCil.exp_is_in_scope scope exp)
0 commit comments