Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
reb-ddm committed Jan 3, 2024
1 parent 667261f commit 2845adf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cdomains/apron/linearTwoVarEqualityDomain.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,20 @@ struct
match t.d with
| None -> t
| Some t_d -> let d = EArray.copy t_d in
let subtract_const_from_var_for_single_equality const index element =
let subtract_const_from_var_for_single_equality index element =
let (eq_var_opt, off2) = d.(index) in
if index = var then
match eq_var_opt with
| None -> d.(index) <- (None, Z.(off2 + const))
| Some eq_var -> begin if eq_var <> index then d.(index) <- (None, Z.(off2 + const)) end
| Some eq_var -> begin if eq_var <> index then d.(index) <- (eq_var_opt, Z.(off2 + const)) end
else
begin match eq_var_opt with
| Some eq_var ->
if eq_var = var then d.(index) <- (Some eq_var, Z.(off2 - const))
if eq_var = var then d.(index) <- (eq_var_opt, Z.(off2 - const))
| None -> ()
end
in
EArray.iteri (subtract_const_from_var_for_single_equality const) d; {d = Some d; env = t.env}
EArray.iteri (subtract_const_from_var_for_single_equality) d; {d = Some d; env = t.env}
end


Expand Down
6 changes: 6 additions & 0 deletions tests/regression/77-lin2vareq/11-overflow_ignored.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ int main() {

__goblint_check(x == k + 1); // SUCCESS

for (int i = 0; i < 7; i++) {
x++;
k++;
}

__goblint_check(x == k + 1); // SUCCESS

return 0;
}

0 comments on commit 2845adf

Please sign in to comment.