1 extern void abort (void); 2 extern void exit (int); 3 struct s { unsigned char a[256]; }; 4 union u { struct { struct s b; int c; } d; struct { int c; struct s b; } e; }; 5 static union u v; 6 static union u v0; 7 static struct s *p = &v.d.b; 8 static struct s *q = &v.e.b; 9 rp(void)10static inline struct s rp (void) { return *p; } rq(void)11static inline struct s rq (void) { return *q; } pq(void)12static void pq (void) { *p = rq(); } qp(void)13static void qp (void) { *q = rp(); } 14 15 static void init(struct s * sp)16init (struct s *sp) 17 { 18 int i; 19 for (i = 0; i < 256; i++) 20 sp->a[i] = i; 21 } 22 23 static void check(struct s * sp)24check (struct s *sp) 25 { 26 int i; 27 for (i = 0; i < 256; i++) 28 if (sp->a[i] != i) 29 abort (); 30 } 31 32 void main_test(void)33main_test (void) 34 { 35 v = v0; 36 init (p); 37 qp (); 38 check (q); 39 v = v0; 40 init (q); 41 pq (); 42 check (p); 43 exit (0); 44 } 45