2 ** tests aliasing of arrays, structs and unions
16 gst
.a
= 3; /* 1. Suspect modification of gst.a */
17 gu
->a
= 5; /* 2. Suspect modification of gu->a */
31 int f (int ia
[], st s1
, ut
*u1
)
38 *ip
= 7; /* modifies ia[3] */
42 *ip
= 8; /* modifies ia[?] */
44 model(ia
); /* modifies ia[6] */
46 model(ip
); /* modifies ia[6] */
49 *(s1
.b
) = 7; /* modifies *(s1.b) */
51 sl
= s1
; /* okay (sl is NOT an alias for s1) */
52 modst(sl
); /* was: does not modify anything --- structure is passed by value */
53 /* NOT TRUE: does modify sl since *s1.b is the same reference */
55 ip
= s1
.b
; /* okay, ip aliases s1.b */
56 *(s1
.b
) = 3; /* modifies s1.b */
57 *ip
= 6; /* modifies s1.b */
58 *(sl
.b
) = 3; /* okay */
60 ul
= u1
; /* ul aliases u1 */
62 ul
->a
= 3; /* modifies u1->a */
63 sl
= ul
->s
; /* okay */
65 *(sl
.b
) = 6; /* modifies *(u1->s.b) through alias */