source:
CIVL/examples/languageFeatures/pointersBad.cvl@
f79e288
| Last change on this file since f79e288 was f79e288, checked in by , 11 years ago | |
|---|---|
|
|
| File size: 383 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 | void main() { |
| 10 | int a; |
| 11 | int* b, *c; |
| 12 | int * nilPtr = NULL; |
| 13 | |
| 14 | c = (void *)(-1); |
| 15 | b = (int *)malloc(sizeof(int)); |
| 16 | free(b); |
| 17 | a = *(&out); |
| 18 | $choose { |
| 19 | $when(x == 0) {a = *c;} |
| 20 | $when(x >=1 ) {a = *b;} |
| 21 | $when(x < 0 ) {a = *nilPtr;} |
| 22 | } |
| 23 | } |
Note:
See TracBrowser
for help on using the repository browser.
