Debian Codegraph @

gcc/testsuite/gcc.dg/torture/pr68963.c

raw
1 /* { dg-do run } */
2
3 static const float a[3] = { 1, 2, 3 };
4 int b = 3;
5
6 __attribute__((noinline, noclone)) void
7 bar (int x)
8 {
9 if (x != b++)
10 __builtin_abort ();
11 }
12
13 void
14 foo (float *x, int y)
15 {
16 int i;
17 for (i = 0; i < 2 * y; ++i)
18 {
19 if (i < y)
20 x[i] = a[i];
21 else
22 {
23 bar (i);
24 x[i] = a[i - y];
25 }
26 }
27 }
28
29 int
30 main ()
31 {
32 float x[10];
33 unsigned int i;
34 for (i = 0; i < 10; ++i)
35 x[i] = 1337;
36 foo (x, 3);
37 for (i = 0; i < 10; ++i)
38 if (x[i] != (i < 6 ? (i % 3) + 1 : 1337))
39 __builtin_abort ();
40 return 0;
41 }