]>
Commit | Line | Data |
---|---|---|
7c82d827 | 1 | /* { dg-do run } */ |
d7bfc710 | 2 | /* { dg-additional-options "-ftree-parallelize-loops=2" } */ |
7c82d827 | 3 | |
ab3306d2 TV |
4 | /* Variable bound, reduction. */ |
5 | ||
1222f22b TV |
6 | #include <stdlib.h> |
7 | ||
ab3306d2 TV |
8 | #define N 4000 |
9 | ||
7c82d827 TV |
10 | unsigned int *a; |
11 | ||
12 | unsigned int __attribute__((noclone,noinline)) | |
4f75d608 | 13 | f (unsigned int n, unsigned int *__restrict__ a) |
7c82d827 TV |
14 | { |
15 | int i; | |
16 | unsigned int sum = 1; | |
17 | ||
18 | for (i = 0; i < n; ++i) | |
19 | sum += a[i]; | |
20 | ||
21 | return sum; | |
22 | } | |
23 | ||
24 | int | |
25 | main (void) | |
26 | { | |
27 | unsigned int res; | |
ab3306d2 | 28 | unsigned int array[N]; |
7c82d827 | 29 | int i; |
1222f22b | 30 | |
ab3306d2 | 31 | for (i = 0; i < N; ++i) |
7c82d827 TV |
32 | array[i] = i % 7; |
33 | a = &array[0]; | |
1222f22b | 34 | |
4f75d608 | 35 | res = f (N, a); |
1222f22b TV |
36 | if (res != 11995) |
37 | abort (); | |
38 | ||
39 | return 0; | |
7c82d827 | 40 | } |