]> andersk Git - splint.git/blame - test/alias2.c
Changed the version from 3.1.1 to 3.1.0
[splint.git] / test / alias2.c
CommitLineData
885824d3 1int glob;
2int *globp;
3
4int f(int *a, int b, int **c)
5{
6 int *x, *y, *z;
7
8 {
9 {
10 int *lx;
11
12 x = a;
13 lx = a;
14 {
15 /*@-shadow@*/ int *lx; /*@=shadow@*/
16
17 *lx = 3; /* 1. use before def */
18 y = *c;
19 }
20 *lx = 4; /* 2. modifies a */
21 }
22 x = y; /* x aliases *c */
23 x = *c;
24 }
25
26 if (b == *a)
27 {
28 x = a; /* okay - x alias a */
29 *x = 3; /* 3. modifies *a */
30 y = &glob;
31 }
32 else
33 {
34 *x = 3; /* 4. modifies **c */
35 y = globp;
36 }
37
38 *x = 4; /* 5, 6. bad - may modify *a or **c */
39 z = a;
40
41 if ((**c = b) == 3) /* 7. modifies **c */
42 {
43 *y = 3; /* 8, 9. may modify glob and *globp */
44 globp = a; /* 10. modifies globp */
45 a = y;
46 z = globp;
47 }
48 else
49 {
50 a = z;
51 }
52
53 *a = 3; /* 11, 12. modifies glob, *globp through y and z */
54 *z = 6; /* 13, 14. modifies *a, *globp */
55 *globp = 5; /* 15, 16. modifies *globp, *a */
56 return 3; /* 17. leaves globp aliasing a */
57}
58
59
60
61
62
63
64
This page took 0.055168 seconds and 5 git commands to generate.