1 /* Mis-aligned packed structures.  */
2 
3 typedef struct
4 {
5   char b0;
6   char b1;
7   char b2;
8   char b3;
9   char b4;
10   char b5;
11 } __attribute__ ((packed)) b_struct;
12 
13 
14 typedef struct
15 {
16   short a;
17   long b;
18   short c;
19   short d;
20   b_struct e;
21 } __attribute__ ((packed)) a_struct;
22 
23 
24 int
main(void)25 main(void)
26 {
27   volatile a_struct *a;
28   volatile a_struct b;
29 
30   a = &b;
31   *a = (a_struct){1,2,3,4};
32   a->e.b4 = 'c';
33 
34   if (a->a != 1 || a->b != 2 || a->c != 3 || a->d != 4 || a->e.b4 != 'c')
35     abort ();
36 
37   exit (0);
38 }
39