aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/pr34146-2.c
blob: 31007b07f819784a55aa7ffa473dc8714c50a0ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* PR c/34146 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-gimple" } */

struct A
{
  int f1, f2, f3;
};

struct B
{
  struct A g1, g2;
};

struct C
{
  struct B h1, h2;
};

typedef union
{
  struct C c;
  char s[4];
  long int a;
} T;

void
foo (void)
{
  T t = (T) { { { { 0, 0, 0 }, { 0, 0, 0 } }, { { 0, 0, 0 }, { 0, 0, 0 } } } };
  test (&t);
}

void
bar (void)
{
  T t = (T) { { { { 0, 0, 0 }, (struct A) { 0, 0, 0 } },
	      (struct B) { (struct A) { 0, 0, 0 }, { 0, 0, 0 } } } };
  test (&t);
}

void
baz (void)
{
  T t = (T) { { { { 0, 0, 0 }, (struct A) { 1, 1, 1 } },
	      (struct B) { (struct A) { 0, 0, 0 }, { 1, 1, 1 } } } };
  test (&t);
}

/* { dg-final { scan-tree-dump-not "t = D" "gimple"} } */
/* { dg-final { scan-tree-dump-not "t\.c\.h\[12\] = D" "gimple"} } */
/* { dg-final { scan-tree-dump-not "\.g\[12\] = D" "gimple"} } */
/* { dg-final { cleanup-tree-dump "gimple" } } */