Debian Codegraph @

gcc/testsuite/gcc.dg/torture/restrict-7.c

raw
1 /* { dg-do run } */
2
3 extern void abort (void);
4
5 static inline __attribute__((always_inline)) void
6 copy(int *restrict a, int *restrict b)
7 {
8 *b = *a;
9 *a = 7;
10 }
11
12 void __attribute__((noinline))
13 floppy(int mat[static 2], unsigned idxs[static 3])
14 {
15 for (int i = 0; i < 3; i++)
16 copy(&mat[i%2], &mat[idxs[i]]);
17 }
18
19 int main()
20 {
21 int mat[2] = {10, 20};
22 unsigned idxs[3] = {1, 0, 1};
23 floppy(mat, idxs);
24 if (mat[0] != 7 || mat[1] != 10)
25 abort ();
26 return 0;
27 }