]> andersk Git - splint.git/blob - test/alias2.c
Pushed back constraintResolve.c to the previous version.
[splint.git] / test / alias2.c
1 int glob;
2 int *globp;
3
4 int 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.52221 seconds and 5 git commands to generate.