| 1 |
struct s { |
| 2 |
unsigned char a[256]; |
| 3 |
}; |
| 4 |
union u { |
| 5 |
struct { struct s b; int c; } d; |
| 6 |
struct { int c; struct s b; } e; |
| 7 |
}; |
| 8 |
|
| 9 |
static union u v; |
| 10 |
static struct s *p = &v.d.b; |
| 11 |
static struct s *q = &v.e.b; |
| 12 |
|
| 13 |
static struct s __attribute__((noinline)) rp(void) |
| 14 |
{ |
| 15 |
return *p; |
| 16 |
} |
| 17 |
|
| 18 |
static void qp(void) |
| 19 |
{ |
| 20 |
*q = rp(); |
| 21 |
} |
| 22 |
|
| 23 |
int main() |
| 24 |
{ |
| 25 |
int i; |
| 26 |
for (i = 0; i < 256; i++) |
| 27 |
p->a[i] = i; |
| 28 |
qp(); |
| 29 |
for (i = 0; i < 256; i++) |
| 30 |
if (q->a[i] != i) |
| 31 |
__builtin_abort(); |
| 32 |
return 0; |
| 33 |
} |