source: CIVL/examples/loop_invariants/loop_assigns_given/twoSectionArray-bad.cvl

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: 457 bytes
RevLine 
[7f61d3c]1$input int N;
2$assume(N > 0);
3$input int M;
4$assume(0 < M && M < N);
5
6#pragma CIVL ACSL
7
8int main() {
9 int b[N];
10
11 /*@ loop invariant 0 <= i && i <= N;
12 @ loop invariant \forall int i1; 0 <= i1 && i1 < (i<=M?i:M) ==> b[i1] == 0;
13 @ loop invariant \forall int i1; M < i1 && i1 < i ==> b[i1] == 1;
14 @ loop assigns i, b[0 .. M-1], b[M .. N-1];
15 @*/
16 for (int i = 0; i < N; i++) {
17 if (i < M) b[i] = 0;
18 else if (i > M) b[i] = 0;
19 }
20}
Note: See TracBrowser for help on using the repository browser.