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:
853 bytes
|
| Line | |
|---|
| 1 | /* Found bug!
|
|---|
| 2 | * Reading an uninitialized value of b[i] causes CIVL to take branch which invalidates assertion.
|
|---|
| 3 | */
|
|---|
| 4 | #include <stdlib.h>
|
|---|
| 5 | #include <assert.h>
|
|---|
| 6 | #pragma CIVL ACSL
|
|---|
| 7 | int __VERIFIER_nondet_int(void) {
|
|---|
| 8 | int x;
|
|---|
| 9 | $havoc(&x);
|
|---|
| 10 | return x;
|
|---|
| 11 | }
|
|---|
| 12 | $input int N;
|
|---|
| 13 | $assume (15000 < N);
|
|---|
| 14 | int main()
|
|---|
| 15 | {
|
|---|
| 16 |
|
|---|
| 17 | int i;
|
|---|
| 18 | int a[N];
|
|---|
| 19 | int b[N];
|
|---|
| 20 | int c[N];
|
|---|
| 21 |
|
|---|
| 22 | //init and update
|
|---|
| 23 | //@ transform flatten i;
|
|---|
| 24 | for (i = 0; i < N; i++)
|
|---|
| 25 | {
|
|---|
| 26 | int q = __VERIFIER_nondet_int();
|
|---|
| 27 | a[i] = 0;
|
|---|
| 28 | if (q == 0)
|
|---|
| 29 | {
|
|---|
| 30 | a[i] = 1;
|
|---|
| 31 | b[i] = i % 2;
|
|---|
| 32 | }
|
|---|
| 33 | if (a[i] != 0)
|
|---|
| 34 | {
|
|---|
| 35 | if (b[i] == 0)
|
|---|
| 36 | {
|
|---|
| 37 | c[i] = 0;
|
|---|
| 38 | }
|
|---|
| 39 | else
|
|---|
| 40 | {
|
|---|
| 41 | c[i] = 1;
|
|---|
| 42 | }
|
|---|
| 43 | }
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | a[15000] = 1;
|
|---|
| 47 |
|
|---|
| 48 | // modified:
|
|---|
| 49 | //@ transform flatten i;
|
|---|
| 50 | $assert($forall(int i:0..N-1) i == 15000 => c[i] == 0);
|
|---|
| 51 | /* original:
|
|---|
| 52 | for (i = 0; i < N; i++)
|
|---|
| 53 | {
|
|---|
| 54 | if (i == 15000 )
|
|---|
| 55 | {
|
|---|
| 56 | __VERIFIER_assert(c[i] == 0);
|
|---|
| 57 | }
|
|---|
| 58 | }
|
|---|
| 59 | */
|
|---|
| 60 | return 0;
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.