Skip to content

Commit

Permalink
Fix inconsistent strengthening behavior with polyhedra
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Mar 11, 2024
1 parent 7c625f9 commit 6051f2a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/cdomains/apron/apronDomain.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -639,14 +639,21 @@ struct
(* Whether [con1] contains a var in [env]. *)
let env_exists_mem_con1 env con1 =
try
Lincons1.iter (fun _ var ->
if Environment.mem_var env var then
Lincons1.iter (fun coeff var ->
(* Lincons1 from polyhedra may contain variable with zero coefficient.
These are silently not printed! *)
if not (Coeff.is_zero coeff) && Environment.mem_var env var then
raise Not_found
) con1;
false
with Not_found ->
true
in
let env_exists_mem_con1 env con1 =
let r = env_exists_mem_con1 env con1 in
if M.tracing then M.trace "apron" "env_exists_mem_con1 %s %s -> %B\n" (Format.asprintf "%a" (Environment.print: Format.formatter -> Environment.t -> unit) env) (Lincons1.show con1) r;
r
in
(* Heuristically reorder constraints to pass 36/12 with singlethreaded->multithreaded mode switching. *)
(* Put those constraints which strictly are in one argument's env first, to (hopefully) ensure they remain. *)
let (x_cons1_some_y, x_cons1_only_x) = Array.partition (env_exists_mem_con1 y_env) x_cons1 in
Expand Down
2 changes: 0 additions & 2 deletions tests/regression/56-witness/25-apron-unassume-strengthening.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ int main() {
__goblint_check(x >= 0);
__goblint_check(x < y); // TODO? Used to work without type bounds: https://github.com/goblint/analyzer/issues/1373.
}

// TODO: Why swapped with polyhedra?
return 0;
}

0 comments on commit 6051f2a

Please sign in to comment.