view gcc/testsuite/gcc.dg/tree-ssa/pr34146.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* 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 test (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"} } */