aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/pr44258.c
blob: 6dc233b3231ff7946406041aff309030812426f1 (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-esra-details" } */

struct blah
{
  char a[4];
};

struct str
{
  struct blah b1;
  char x;
};

struct val
{
  char y;
  struct blah b2;
};

union U
{
  struct str str;
  struct val val;
};


extern struct blah e_b1, e_b2;
extern union U *e_u;

int foo (int b)
{
  union U u;

  u.str.b1 = e_b1;
  u.val.b2 = e_b2;
  u.str.b1.a[3] = 0;

  *e_u = u;
}

/* Epiphany has struct alignment/padding that avoids the overlap of
   str.b1 and val.b2.  */
/* { dg-final { scan-tree-dump-times "Created a replacement" 0 "esra" { target { ! "epiphany-*-*" } } } } */
/* { dg-final { cleanup-tree-dump "esra" } } */