source:
CIVL/examples/languageFeatures/pointersBad.cvl@
ac11fb1
| Last change on this file since ac11fb1 was 19d1808f, checked in by , 11 years ago | |
|---|---|
|
|
| File size: 394 bytes | |
| Rev | Line | |
|---|---|---|
| [262ecde] | 1 | /* Commandline execution: |
| 2 | * civl verify pointersBad.cvl | |
| 3 | * */ | |
| 4 | #include<civlc.cvh> | |
| 5 | #include<stdlib.h> | |
| 6 | ||
| 7 | $output int out; | |
| [050ee5d] | 8 | $input int *x_ptr; |
| [262ecde] | 9 | void main() { |
| 10 | int a; | |
| [f79e288] | 11 | int* b, *c; |
| 12 | int * nilPtr = NULL; | |
| [262ecde] | 13 | |
| [f79e288] | 14 | c = (void *)(-1); |
| [262ecde] | 15 | b = (int *)malloc(sizeof(int)); |
| 16 | free(b); | |
| [f79e288] | 17 | $choose { |
| [19d1808f] | 18 | {a = *(&out);} |
| 19 | {a = *x_ptr;} | |
| 20 | {c = &a + 1; a = *c;} | |
| 21 | {a = *c;} | |
| 22 | {a = *b;} | |
| 23 | {a = *nilPtr;} | |
| [f79e288] | 24 | } |
| [262ecde] | 25 | } |
Note:
See TracBrowser
for help on using the repository browser.
