summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr34146.c
blob: 99fdeb5edfef2517519e190b72b9a793e87cff16 (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 = { { { { 0, 0, 0 }, { 0, 0, 0 } }, { { 0, 0, 0 }, { 0, 0, 0 } } } };
  test (&t);
}

void
bar (void)
{
  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 = { { { { 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" } } */