libgomp/testsuite/libgomp.c/pr80853.c
raw| 1 | /* PR middle-end/80853 */ |
| 2 | /* { dg-do run } */ |
| 3 | |
| 4 | __attribute__((noinline, noclone)) void |
| 5 | foo (int *p) |
| 6 | { |
| 7 | #pragma omp for reduction(+:p[:4]) |
| 8 | for (int i = 0; i < 64; i++) |
| 9 | { |
| 10 | p[0] += i; |
| 11 | p[1] += i / 2; |
| 12 | p[2] += 2 * i; |
| 13 | p[3] += 3 * i; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | int |
| 18 | main () |
| 19 | { |
| 20 | int p[4] = { 0, 0, 0, 0 }; |
| 21 | #pragma omp parallel |
| 22 | foo (p); |
| 23 | if (p[0] != 63 * 64 / 2 |
| 24 | || p[1] != 31 * 32 |
| 25 | || p[2] != 63 * 64 |
| 26 | || p[3] != 3 * 63 * 64 / 2) |
| 27 | __builtin_abort (); |
| 28 | return 0; |
| 29 | } |