1 /* { dg-do run { target *-*-linux* } } */
2 /* { dg-options "-O2 -fzero-call-used-regs=used-gpr" } */
3 
4 struct S { int i; };
5 __attribute__((const, noinline, noclone))
foo(int x)6 struct S foo (int x)
7 {
8   struct S s;
9   s.i = x;
10   return s;
11 }
12 
13 int a[2048], b[2048], c[2048], d[2048];
14 struct S e[2048];
15 
16 __attribute__((noinline, noclone)) void
bar(void)17 bar (void)
18 {
19   int i;
20   for (i = 0; i < 1024; i++)
21     {
22       e[i] = foo (i);
23       a[i+2] = a[i] + a[i+1];
24       b[10] = b[10] + i;
25       c[i] = c[2047 - i];
26       d[i] = d[i + 1];
27     }
28 }
29 
30 int
main()31 main ()
32 {
33   int i;
34   bar ();
35   for (i = 0; i < 1024; i++)
36     if (e[i].i != i)
37       __builtin_abort ();
38   return 0;
39 }
40