File tree 2 files changed +40
-10
lines changed
tests/regression/63-affeq
2 files changed +40
-10
lines changed Original file line number Diff line number Diff line change @@ -680,19 +680,15 @@ struct
680
680
681
681
let invariant t =
682
682
let invariant m =
683
- let earray = Lincons1. array_make t.env (Matrix. num_rows m) in
684
- for i = 0 to Lincons1. array_length earray do
683
+ let one_constraint i =
685
684
let row = Matrix. get_row m i in
686
685
let coeff_vars = List. map (fun x -> Coeff. s_of_mpqf @@ Vector. nth row (Environment. dim_of_var t.env x), x) (vars t) in
687
686
let cst = Coeff. s_of_mpqf @@ Vector. nth row (Vector. length row - 1 ) in
688
- Lincons1. set_list (Lincons1. array_get earray i) coeff_vars (Some cst)
689
- done ;
690
- let {lincons0_array; array_env}: Lincons1. earray = earray in
691
- Array. enum lincons0_array
692
- |> Enum. map (fun (lincons0 : Lincons0.t ) ->
693
- Lincons1. {lincons0; env = array_env}
694
- )
695
- |> List. of_enum
687
+ let e1 = Linexpr1. make t.env in
688
+ Linexpr1. set_list e1 coeff_vars (Some cst);
689
+ Lincons1. make e1 EQ
690
+ in
691
+ List. init (Matrix. num_rows m) one_constraint
696
692
in
697
693
BatOption. map_default invariant [] t.d
698
694
Original file line number Diff line number Diff line change
1
+ //SKIP PARAM: --set ana.activated[+] affeq --set sem.int.signed_overflow assume_none --set ana.relation.privatization top --enable witness.yaml.enabled
2
+ // Identical to Example 63/01; additionally checking that writing out witnesses does not crash the analyzer
3
+ #include <goblint.h>
4
+
5
+ void main (void ) {
6
+ int i ;
7
+ int j ;
8
+ int k ;
9
+ i = 2 ;
10
+ j = k + 5 ;
11
+
12
+ while (i < 100 ) {
13
+ __goblint_check (3 * i - j + k == 1 );
14
+ i = i + 1 ;
15
+ j = j + 3 ;
16
+ }
17
+ __goblint_check (3 * i - j + k == 1 );
18
+
19
+ // Represented with fractional coefficients and thus not put into witness yet
20
+
21
+ int a = 0 ;
22
+ int b = 0 ;
23
+ int z = 0 ;
24
+
25
+ while (z < 100 ) {
26
+ a ++ ;
27
+ b += 2 ;
28
+ z ++ ;
29
+
30
+ __goblint_check (2 * z - b == 0 );
31
+ // b == 2*z is put into the witness
32
+ }
33
+
34
+ }
You can’t perform that action at this time.
0 commit comments