Skip to content

Commit c001b0f

Browse files
Revert find_default to try/Not_found where default is S.Dom.bot()
Agent-Logs-Url: https://github.com/goblint/analyzer/sessions/549bf1a5-1caf-4b0a-b8e3-fadb8c217dea Co-authored-by: michael-schwarz <13812333+michael-schwarz@users.noreply.github.com>
1 parent 9782831 commit c001b0f

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/solver/td3.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ module Base =
666666
else
667667
destabilize_normal;
668668

669-
let sys_change = S.sys_change (fun v -> HM.find_default rho v (S.Dom.bot ())) in
669+
let sys_change = S.sys_change (fun v -> try HM.find rho v with Not_found -> S.Dom.bot ()) in
670670

671671
let old_ret = HM.create 103 in
672672
if reluctant then (
@@ -861,7 +861,7 @@ module Base =
861861
let check_side x y d =
862862
HM.replace visited y ();
863863
let mem = HM.mem rho y in
864-
let d' = HM.find_default rho y (S.Dom.bot ()) in
864+
let d' = try HM.find rho y with Not_found -> S.Dom.bot () in
865865
if not (S.Dom.leq d d') then Logs.error "TDFP Fixpoint not reached in restore step at side-effected variable (mem: %b) %a from %a: %a not leq %a" mem S.Var.pretty_trace y S.Var.pretty_trace x S.Dom.pretty d S.Dom.pretty d'
866866
in
867867
let rec eq check x =
@@ -1049,7 +1049,7 @@ module Base =
10491049
if incr_verify then (
10501050
HM.iter (fun x w ->
10511051
HM.iter (fun y d ->
1052-
let old_d = HM.find_default rho y (S.Dom.bot ()) in
1052+
let old_d = try HM.find rho y with Not_found -> S.Dom.bot () in
10531053
(* Logs.debug "rho_write retrigger %a %a %a %a" S.Var.pretty_trace x S.Var.pretty_trace y S.Dom.pretty old_d S.Dom.pretty d; *)
10541054
HM.replace rho y (S.Dom.join old_d d);
10551055
HM.replace init_reachable y ();

src/solver/topDown.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ module WP =
102102
d
103103
and side x y d =
104104
if tracing then trace "sol2" "side %a ## %a (wpx: %b) ## %a" S.Var.pretty_trace x S.Var.pretty_trace y (HM.mem rho y) S.Dom.pretty d;
105-
let old = HPM.find_default rho' (x,y) (S.Dom.bot ()) in
105+
let old = try HPM.find rho' (x,y) with Not_found -> S.Dom.bot () in
106106
if not (S.Dom.equal old d) then (
107107
add_set x y (S.Dom.join old d);
108108
HM.remove stable y;

src/solver/topDown_space_cache_term.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module WP =
4545
let old = HM.find rho x in
4646
let l = HM.create 10 in
4747
let tmp = eq x (eval l x) (side l) in
48-
let tmp = S.Dom.join tmp (HM.find_default rho' x (S.Dom.bot ())) in
48+
let tmp = S.Dom.join tmp (try HM.find rho' x with Not_found -> S.Dom.bot ()) in
4949
if tracing then trace "sol" "Var: %a" S.Var.pretty_trace x ;
5050
if tracing then trace "sol" "Contrib:%a" S.Dom.pretty tmp;
5151
HM.remove called x;
@@ -94,7 +94,7 @@ module WP =
9494
tmp
9595
and side l y d =
9696
if tracing then trace "sol2" "side to %a (wpx: %b) ## value: %a" S.Var.pretty_trace y (HM.mem rho y) S.Dom.pretty d;
97-
let old = HM.find_default rho' y (S.Dom.bot ()) in
97+
let old = try HM.find rho' y with Not_found -> S.Dom.bot () in
9898
if not (S.Dom.leq d old) then (
9999
HM.replace rho' y (S.Dom.join old d);
100100
HM.remove l y;
@@ -148,7 +148,7 @@ module WP =
148148
) else (
149149
HM.replace visited x ();
150150
let check_side y d =
151-
let d' = HM.find_default rho y (S.Dom.bot ()) in
151+
let d' = try HM.find rho y with Not_found -> S.Dom.bot () in
152152
if not (S.Dom.leq d d') then Logs.error "Fixpoint not reached in restore step at side-effected variable %a: %a not leq %a" S.Var.pretty_trace y S.Dom.pretty d S.Dom.pretty d'
153153
in
154154
let eq x =

src/solver/topDown_term.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module WP =
4949
init x;
5050
let old = HM.find rho x in
5151
let tmp = eq x (eval x) side in
52-
let tmp = S.Dom.join tmp (HM.find_default rho' x (S.Dom.bot ())) in
52+
let tmp = S.Dom.join tmp (try HM.find rho' x with Not_found -> S.Dom.bot ()) in
5353
if tracing then trace "sol" "Var: %a" S.Var.pretty_trace x ;
5454
if tracing then trace "sol" "Contrib:%a" S.Dom.pretty tmp;
5555
HM.remove called x;
@@ -83,7 +83,7 @@ module WP =
8383
add_infl y x;
8484
HM.find rho y
8585
and side y d =
86-
let old = HM.find_default rho' y (S.Dom.bot ()) in
86+
let old = try HM.find rho' y with Not_found -> S.Dom.bot () in
8787
if not (S.Dom.leq d old) then (
8888
HM.replace rho' y (S.Dom.widen old (S.Dom.join old d));
8989
HM.remove stable y;

0 commit comments

Comments
 (0)