source: CIVL/examples/focus/sv-benchmarks-main-c-array-industry-pattern/c/array-industry-pattern/original/array_shadowinit.c

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 645 bytes
Line 
1extern void abort(void);
2#include <assert.h>
3void reach_error() { assert(0); }
4void __VERIFIER_assert(int cond) { if(!(cond)) { ERROR: {reach_error();abort();} } }
5/*
6 The program initializes the array 'a' in a loop having loop counter 'i' with a variable 'k' which is a shadow of 'i'. Checks universally quantified property \forall i, a[i] = i.
7*/
8
9#define fun main
10
11extern int __VERIFIER_nondet_int(void);
12
13int N;
14int main() {
15 N=__VERIFIER_nondet_int();
16 if(N>0) {
17 int i,k;
18 int a[N];
19
20 i=0;
21 k=0;
22 while(i < N) {
23 a[k]=k;
24 i=i+1;
25 k=k+1;
26 }
27
28 i=0;
29 while(i < N) {
30 __VERIFIER_assert(a[i]==i);
31 i=i+1;
32 }
33 }
34 return 0;
35}
Note: See TracBrowser for help on using the repository browser.