| 1 |
/* Verify zero initialization for array, union, and structure type automatic variables. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand -fno-stack-protector" } */ |
| 4 |
|
| 5 |
struct S |
| 6 |
{ |
| 7 |
int f1; |
| 8 |
float f2; |
| 9 |
char f3[20]; |
| 10 |
}; |
| 11 |
|
| 12 |
union U |
| 13 |
{ |
| 14 |
char u1[5]; |
| 15 |
int u2; |
| 16 |
float u3; |
| 17 |
}; |
| 18 |
|
| 19 |
double result; |
| 20 |
|
| 21 |
double foo() |
| 22 |
{ |
| 23 |
int temp1[3]; |
| 24 |
double temp2[3]; |
| 25 |
struct S temp3; |
| 26 |
union U temp4; |
| 27 |
|
| 28 |
result = temp1[2] + temp2[1] + temp3.f2 + temp4.u3; |
| 29 |
return result; |
| 30 |
} |
| 31 |
|
| 32 |
/* { dg-final { scan-rtl-dump-times "const_int 0" 8 "expand" } } */ |