Debian Codegraph @

gcc/testsuite/gcc.target/i386/ret-thunk-26.c

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