source: CIVL/examples/languageFeatures/pointersBad.cvl@ fb371c8

1.23 2.0 main test-branch
Last change on this file since fb371c8 was fb371c8, checked in by Ziqing Luo <ziqing@…>, 11 years ago

update

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

  • Property mode set to 100644
File size: 491 bytes
Line 
1/* Commandline execution:
2 * civl verify pointersBad.cvl
3 * */
4#include<civlc.cvh>
5#include<stdlib.h>
6
7$output int out;
8$input int x;
9$input int *x_ptr;
10void main() {
11 int a;
12 int* b, *c;
13 int * nilPtr = NULL;
14
15 c = (void *)(-1);
16 b = (int *)malloc(sizeof(int));
17 free(b);
18 $choose {
19 $when(x == 3) {a = *(&out);}
20 $when(x == 2) {a = *x_ptr;}
21 $when(x == 1) {c = &a + 1; a = *c;}
22 $when(x == 0) {a = *c;}
23 $when(x >= 4) {a = *b;}
24 $when(x < 0) {a = *nilPtr;}
25 }
26}
Note: See TracBrowser for help on using the repository browser.