File tree 2 files changed +36
-0
lines changed
regression/contracts-dfcc/ternary-lhs-loop-contract
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <stdbool.h>
2
+ #include <stdlib.h>
3
+
4
+ void foo (int a , int b )
5
+ {
6
+ char arr1 [10 ];
7
+ char arr2 [10 ];
8
+ char arr3 [10 ];
9
+ int i = 0 ;
10
+
11
+ while (i < 10 )
12
+ __CPROVER_loop_invariant (0 <= i && i <= 10 )
13
+ {
14
+ ((a > 0 ) ? arr1 : b > 0 ? arr2 : arr3 )[i ] = 0 ;
15
+ i ++ ;
16
+ }
17
+ }
18
+
19
+ int main ()
20
+ {
21
+ int a ;
22
+ int b ;
23
+ foo (a , b );
24
+ return 0 ;
25
+ }
Original file line number Diff line number Diff line change
1
+ CORE dfcc-only
2
+ main.c
3
+ --dfcc main --enforce-contract foo --apply-loop-contracts
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ --
9
+ checks that when assignment lhs expressions have ternary expressions,
10
+ loop assigns clause checking correctly infers what gets assigned and
11
+ automatically tracks targets in the both the top level and the loop write sets.
You can’t perform that action at this time.
0 commit comments