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
Copy file name to clipboardExpand all lines: src/analyses/baseInvariant.ml
+17-7Lines changed: 17 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -117,13 +117,13 @@ struct
117
117
let lvals = eval_lv ~man st (Mem (Lval lv), NoOffset) in
118
118
(* Additional offset of value being refined in Addr Offset type *)
119
119
let original_offset = convert_offset ~man st off in
120
-
let res =AD.fold (funbase_aacc ->
121
-
Option.bind acc (funacc ->
120
+
let res =AD.fold (funbase_ast ->
121
+
Option.bind st (fun(st, ad) ->
122
122
match base_a with
123
123
|Addrbase_mval ->
124
124
let (lval_a:VD.t) =Address (AD.singleton base_a) in
125
125
ifM.tracing thenM.tracel "inv""Consider case of lval %a = %a" d_lval lv VD.pretty lval_a;
126
-
let st = set' lv lval_a st in
126
+
(*let st = set' lv lval_a st in*)
127
127
let orig =PreValueDomain.Addr.Mval.add_offset base_mval original_offset in
128
128
let old_val = get_mval ~man st orig Nonein
129
129
let old_val =VD.cast ~kind:Internal (Cilfacade.typeOfLval x) old_val in(* needed as the type of this pointer may be different *)(* TODO: proper castkind *)
@@ -132,16 +132,26 @@ struct
132
132
let old_val = map_oldval old_val (Cilfacade.typeOfLval x) in
133
133
let v = apply_invariant ~old_val~new_val:c' in
134
134
if is_some_bot v then
135
-
Some (D.join acc (try contra st withAnalyses.Deadcode ->D.bot ()))
135
+
Some (st, ad) (* TODO: some contra thing? *)
136
136
else (
137
137
ifM.tracing thenM.tracel "inv""improve lval %a from %a to %a (c = %a, c' = %a)" d_lval x VD.pretty old_val VD.pretty v pretty c VD.pretty c';
138
-
Some (D.join acc (set' x v st))
138
+
Some (set' x v st, AD.add base_a ad)
139
139
)
140
140
|_ -> None
141
141
)
142
-
) lvals (Some (D.bot()))
142
+
) lvals (Some (st, AD.empty()))
143
143
in
144
-
BatOption.map_default_delayed (fund -> ifD.is_bot d then raise Analyses.Deadcodeelse d) default res
0 commit comments