Some consistency changes to library & headers flags.
[splint-patched.git] / test / outparam.c
blob1fd19b35549567d2b9c11653374ae091231b8102
1 typedef struct _st { int a; int b; } *st;
3 void h(st s, st t)
5 int i;
6 st u1, u2;
8 u1->a = 3; /* 1. Variable u1 used before definition */
9 u2 = u1;
10 i = u2->a;
12 i = (*s).a; /* 2. Field s->a used before definition */
13 t->a = i;
16 void f(/*@out@*/ int *a, int *b)
18 int x;
19 int *y;
21 x = *a; /* 3. Value *a used before definition */
22 x = *a; /* not reported */
23 x = *a; /* not reported */
24 x = *b;
26 y = a;
27 *a = 3;
30 int g()
32 int *b;
33 int *c, *d;
34 st s, t, t2, t3, t4;
35 struct _st u;
37 f(c, b); /* 4, 5. Unallocated storage c passed as out parameter: c,
38 Variable b used before definition */
39 f(d, c); /* 6. Unallocated storage d passed as out parameter: d */
40 *c = *d;
41 s = t; /* 7. Variable t used before definition */
42 s = t2->a; /* 8, 9. Variable t2 used before definition,
43 Assignment of int to st: s = t2->a */
44 t3->a = 3; /* 10. Variable t3 used before definition */
45 u.a = 3;
46 t4 = (st)malloc(sizeof(struct _st));
47 t4->a = 3; /* 11. Possible arrow access from null pointer: t4 */
48 return *b; /* 10. Fresh storage not released before return: t4 */