main
test-branch
|
Last change
on this file since bb03188 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:
562 bytes
|
| Rev | Line | |
|---|
| [6261a62] | 1 | /* A non-trivial mimic of havocing an array slice using temporary
|
|---|
| 2 | * variable and quantified assumptions */
|
|---|
| 3 |
|
|---|
| 4 | #include <pointer.cvh>
|
|---|
| 5 | $input int N, M, I;
|
|---|
| 6 | $assume(N > 0 && M > 0 && 0 < I && I < N);
|
|---|
| 7 |
|
|---|
| 8 | void havoc_slice(double (*a)[], int len, int start, int stop) {
|
|---|
| 9 | double tmp[len];
|
|---|
| 10 |
|
|---|
| 11 | $copy(&tmp, a);
|
|---|
| 12 | $havoc(a);
|
|---|
| 13 | $assume(($forall (int j | (0 <= j && j < start) || (stop <= j && j < len))
|
|---|
| 14 | (*a)[j] == tmp[j]));
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | int main () {
|
|---|
| 18 | double a[N*M];
|
|---|
| 19 | double old_zero = a[0];
|
|---|
| 20 |
|
|---|
| 21 | havoc_slice(&a, N*M, I*M, (I+1)*M);
|
|---|
| 22 | $assert(a[0] == old_zero);
|
|---|
| 23 | return 0;
|
|---|
| 24 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.