]> andersk Git - splint.git/blame - test/cast.c
noexpand always false.
[splint.git] / test / cast.c
CommitLineData
885824d3 1typedef int abst1, abst2; /* 1, 2. declaration errors (mutable types */
2typedef char *FILE;
3
4int main (void) {
5 abst1 a; abst1 *ap;
6 abst2 b = 3; /* 3. wrong type */
7 abst2 *bp = (abst2 *) malloc(sizeof(abst2)); /* 4. cast to underlying abstract */
8 FILE *f;
9 int *ip = (int *)malloc(sizeof(int));
10
11 *ip = 3; /* 5. possible null deref */
12 *bp = 5; /* 6, 7. possible null deref, assignment of int to abst2 */
13/* 13 */ a = (abst1)ip; /* 8. cast to abstract */
14/* 14 */ ap = (abst1 *)ip; /* 9. cast to underlying abstract */
15 f = (FILE *)ip; /* 10. cast to underlying abstract */
16 a = (abst1)a; /* 11. redundant abstract cast */
17/* 17 */ ip = (int *)ap; /* 12, 13. cast from underlying abstract, allocated ip not released */
18 ip = (int *)f; /* 13. cast from underlying abstract */
19/* 19 */ ip = (int *)a; /* 14. cast from underlying abstract */
20/* 20 */ a = (abst1)b; /* 15, 16. cast from abst2, cast to abst1 */
21/* 21 */ ap = (abst1 *)bp; /* 17, 18. cast to abst1 * , cast from abst2 * */
22 return 0; /* 19, 20. ip and bp not released */
23}
This page took 0.093926 seconds and 5 git commands to generate.