File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
regression/contracts/z3_array_comprehension Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <stdlib.h>
2
+ void foo (char * dst , const char * src , size_t n )
3
+ __CPROVER_requires (__CPROVER_is_fresh (src , n ))
4
+ __CPROVER_requires (__CPROVER_is_fresh (dst , n ))
5
+ __CPROVER_assigns (__CPROVER_object_from (dst ))
6
+ __CPROVER_ensures (__CPROVER_forall {size_t j ; j < n == > dst [j ] == src [j ]})
7
+ {
8
+ for (size_t i = 0 ; i < n ; i ++ )
9
+ __CPROVER_assigns (i , __CPROVER_object_from (dst ))
10
+ // commenting out the loop invariant to make the analysis fail and reveal the error
11
+ // __CPROVER_loop_invariant(i <= n)
12
+ // __CPROVER_loop_invariant(__CPROVER_forall{size_t j; j < i ==> dst[j] == src[j]})
13
+ {
14
+ dst [i ] = src [i ];
15
+ }
16
+ }
17
+
18
+ int main ()
19
+ {
20
+ char * dst ;
21
+ char * src ;
22
+ size_t n ;
23
+ foo (dst , src , n );
24
+ return 0 ;
25
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --dfcc main --enforce-contract foo --apply-loop-contracts --malloc-may-fail --malloc-fail-null _ --z3
4
+ ^\** 1 of 54 failed (2 iterations)$
5
+ ^EXIT=10$
6
+ ^SIGNAL=0$
7
+ ^VERIFICATION FAILED$
8
+ --
9
+ SMT2 solver returned error message:
10
+ invalid get-value term, term must be ground and must not contain quantifiers
11
+ --
12
+ Checks that there are not get-value errors related to lambdas in array
13
+ comprehension leading to quantifiers in z3 values.
You can’t perform that action at this time.
0 commit comments