]> andersk Git - splint.git/blame - test/outparam.c
Fixed manual csvoverwrite.
[splint.git] / test / outparam.c
CommitLineData
885824d3 1typedef struct _st { int a; int b; } *st;
2
3void h(st s, st t)
4{
5 int i;
6 st u1, u2;
7
8 u1->a = 3; /* 1. Variable u1 used before definition */
9 u2 = u1;
10 i = u2->a;
11
12 i = (*s).a; /* 2. Field s->a used before definition */
13 t->a = i;
14}
15
16void f(/*@out@*/ int *a, int *b)
17{
18 int x;
19 int *y;
20
21 x = *a; /* 3. Value *a used before definition */
22 x = *a; /* not reported */
23 x = *a; /* not reported */
24 x = *b;
25
26 y = a;
27 *a = 3;
28}
29
30int g()
31{
32 int *b;
33 int *c, *d;
34 st s, t, t2, t3, t4;
35 struct _st u;
36
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 */
49}
50
51
52
This page took 1.018819 seconds and 5 git commands to generate.