Skip to content

Commit 453a1bb

Browse files
bot_env treatment more explicit
1 parent 8b6b68a commit 453a1bb

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/cdomains/apron/linearTwoVarEqualityDomain.apron.ml

+8-12
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ struct
278278
let to_yojson _ = failwith "ToDo Implement in future"
279279

280280
let is_bot t = equal t (bot ())
281-
let is_bot_env t = t.d = None
282281

283282
(* this shows "top" for a specific environment to enable the calculations. It is the top_of of all equalities *)
284283
let top_of env = {d = Some (EArray.make_empty_array (Environment.size env)); env = env}
@@ -417,22 +416,19 @@ struct
417416
List.iter iterate new_components; Some ad
418417
in
419418
(*Normalize the two domains a and b such that both talk about the same variables*)
420-
if is_bot_env a then
421-
b
422-
else if is_bot_env b then
423-
a
424-
else
425-
match Option.get a.d, Option.get b.d with
426-
| x, y when is_top a || is_top b ->
419+
match a.d, b.d with
420+
| None, _ -> b
421+
| _, None -> a
422+
| Some x, Some y when is_top a || is_top b ->
427423
let new_env = Environment.lce a.env b.env in
428424
top_of new_env
429-
| x, y when (Environment.compare a.env b.env <> 0) ->
425+
| Some x, Some y when (Environment.compare a.env b.env <> 0) ->
430426
let sup_env = Environment.lce a.env b.env in
431427
let mod_x = dim_add (Environment.dimchange a.env sup_env) x in
432428
let mod_y = dim_add (Environment.dimchange b.env sup_env) y in
433429
{d = join_d mod_x mod_y; env = sup_env}
434-
| x, y when EArray.equal x y -> {d = Some x; env = a.env}
435-
| x, y -> {d = join_d x y; env = a.env}
430+
| Some x, Some y when EArray.equal x y -> {d = Some x; env = a.env}
431+
| Some x, Some y -> {d = join_d x y; env = a.env}
436432

437433
let join a b = timing_wrap "join" (join a) b
438434

@@ -601,7 +597,7 @@ struct
601597
*)
602598
let meet_tcons ask t tcons original_expr no_ov =
603599
match t.d with
604-
| None -> bot_env (* same as is_bot_env t *)
600+
| None -> t
605601
| Some d ->
606602
match simplified_monomials_from_texp t (Texpr1.to_expr @@ Tcons1.get_texpr1 tcons) with
607603
| None -> t

0 commit comments

Comments
 (0)