| 1 |
/* Verify zero initialization for union type with structure field with |
| 2 |
padding. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-ftrivial-auto-var-init=zero" } */ |
| 5 |
|
| 6 |
struct test_trailing_hole { |
| 7 |
int one; |
| 8 |
int two; |
| 9 |
int three; |
| 10 |
char four; |
| 11 |
/* "sizeof(unsigned long) - 1" byte padding hole here. */ |
| 12 |
}; |
| 13 |
|
| 14 |
union test_union_padding { |
| 15 |
struct test_trailing_hole u1; |
| 16 |
long long u2; |
| 17 |
}; |
| 18 |
|
| 19 |
|
| 20 |
int foo () |
| 21 |
{ |
| 22 |
union test_union_padding var; |
| 23 |
return var.u1.four; |
| 24 |
} |
| 25 |
|
| 26 |
/* { dg-final { scan-assembler "stp\txzr, xzr," } } */ |
| 27 |
|