summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr42475.c
blob: a5edffa78eba8e539d5f8db3955b547f603523da (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
/* PR rtl-optimization/42475 */
/* { dg-do compile } */
/* { dg-options "-O2" } */

typedef struct { float x, y; } B;
typedef struct { float z; } C;
typedef struct { B b; C c; } D;

B
foo (float x, float y)
{
  B b = { .x = x, .y = y };
  return b;
}

B
bar (B b, B y)
{
  return foo (y.x + b.x, b.y);
}

B
baz (D p)
{
  D d = { };
  B y = bar (foo (0, (p.c.z) / 2), d.b);
  return y;
}