| 1 |
/* PR c/34146 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-gimple" } */ |
| 4 |
|
| 5 |
struct A |
| 6 |
{ |
| 7 |
int f1, f2, f3; |
| 8 |
}; |
| 9 |
|
| 10 |
struct B |
| 11 |
{ |
| 12 |
struct A g1, g2; |
| 13 |
}; |
| 14 |
|
| 15 |
struct C |
| 16 |
{ |
| 17 |
struct B h1, h2; |
| 18 |
}; |
| 19 |
|
| 20 |
typedef union |
| 21 |
{ |
| 22 |
struct C c; |
| 23 |
char s[4]; |
| 24 |
long int a; |
| 25 |
} T; |
| 26 |
|
| 27 |
void test (T *); |
| 28 |
|
| 29 |
void |
| 30 |
foo (void) |
| 31 |
{ |
| 32 |
T t = (T) { { { { 0, 0, 0 }, { 0, 0, 0 } }, { { 0, 0, 0 }, { 0, 0, 0 } } } }; |
| 33 |
test (&t); |
| 34 |
} |
| 35 |
|
| 36 |
void |
| 37 |
bar (void) |
| 38 |
{ |
| 39 |
T t = (T) { { { { 0, 0, 0 }, (struct A) { 0, 0, 0 } }, |
| 40 |
(struct B) { (struct A) { 0, 0, 0 }, { 0, 0, 0 } } } }; |
| 41 |
test (&t); |
| 42 |
} |
| 43 |
|
| 44 |
void |
| 45 |
baz (void) |
| 46 |
{ |
| 47 |
T t = (T) { { { { 0, 0, 0 }, (struct A) { 1, 1, 1 } }, |
| 48 |
(struct B) { (struct A) { 0, 0, 0 }, { 1, 1, 1 } } } }; |
| 49 |
test (&t); |
| 50 |
} |
| 51 |
|
| 52 |
/* { dg-final { scan-tree-dump-not "t = D" "gimple"} } */ |
| 53 |
/* { dg-final { scan-tree-dump-not "t\.c\.h\[12\] = D" "gimple"} } */ |
| 54 |
/* { dg-final { scan-tree-dump-not "\.g\[12\] = D" "gimple"} } */ |