PR tree-optimization/33562
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / sra-14.c
blob6cbc0b43d583629d759baa66e6acc17f1fc9d7e4
1 /* { dg-do run } */
2 /* { dg-options "-O1" } */
4 struct S
6 int i, j;
7 };
9 struct Z
11 struct S d, s;
14 struct S __attribute__ ((noinline, noclone))
15 get_s (void)
17 struct S s;
18 s.i = 5;
19 s.j = 6;
21 return s;
24 struct S __attribute__ ((noinline, noclone))
25 get_d (void)
27 struct S d;
28 d.i = 0;
29 d.j = 0;
31 return d;
34 int __attribute__ ((noinline, noclone))
35 get_c (void)
37 return 1;
40 int __attribute__ ((noinline, noclone))
41 my_nop (int i)
43 return i;
46 int __attribute__ ((noinline, noclone))
47 foo (void)
49 struct Z z;
50 int i, c = get_c ();
52 z.d = get_d ();
53 z.s = get_s ();
55 for (i = 0; i < c; i++)
57 z.s.i = my_nop (z.s.i);
58 z.s.j = my_nop (z.s.j);
61 return z.s.i + z.s.j;
64 int main (int argc, char *argv[])
66 if (foo () != 11)
67 __builtin_abort ();
68 return 0;