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:
642 bytes
|
| Rev | Line | |
|---|
| [2d8a937] | 1 | /* Commandline execution:
|
|---|
| 2 | * civl verify malloc.cvl
|
|---|
| 3 | * */
|
|---|
| 4 | #include <civlc.cvh>
|
|---|
| 5 | #include <string.h>
|
|---|
| 6 | #include <stdlib.h>
|
|---|
| 7 |
|
|---|
| 8 | void main() {
|
|---|
| 9 | int i = 1;
|
|---|
| 10 | //calloc in a declaration
|
|---|
| 11 | int *p = calloc(1, sizeof(int));
|
|---|
| 12 | int *q;
|
|---|
| 13 |
|
|---|
| 14 | $assert(*p==0);
|
|---|
| 15 | //calloc in an expression in the block
|
|---|
| 16 | q = calloc(1, sizeof(int));
|
|---|
| 17 | $assert(*q==0);
|
|---|
| 18 | $free(q);
|
|---|
| 19 |
|
|---|
| 20 | //calloc in an expression wrapped by if
|
|---|
| 21 | if (*p == 0)
|
|---|
| 22 | q = calloc(1, sizeof(int));
|
|---|
| 23 | if (*p == 0){
|
|---|
| 24 | $assert(*q==0);
|
|---|
| 25 | $free(q);
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | //calloc in an expression wrapped by for
|
|---|
| 29 | for (int n = 0; n < i; n++)
|
|---|
| 30 | q = calloc(1, sizeof(int));
|
|---|
| 31 | $assert(*q==0);
|
|---|
| 32 | $free(q);
|
|---|
| 33 |
|
|---|
| 34 | $free(p);
|
|---|
| 35 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.