1 | // RUN: %libomp-compile-and-run |
---|---|
2 | #include <stdio.h> |
3 | |
4 | int main() |
5 | { |
6 | |
7 | int i; |
8 | int i1 = 0; |
9 | int i2 = 1; |
10 | int i3 = 2; |
11 | int i4 = 3; |
12 | int i5 = 4; |
13 | int i6 = 6; |
14 | int i7 = 7; |
15 | int i8 = 8; |
16 | int i9 = 9; |
17 | int i10 = 10; |
18 | int i11 = 11; |
19 | int i12 = 12; |
20 | int i13 = 13; |
21 | int i14 = 14; |
22 | int i15 = 15; |
23 | int i16 = 16; |
24 | |
25 | int r = 0; |
26 | #pragma omp parallel for firstprivate(i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16) reduction(+:r) |
27 | for (i = 0; i < i16; i++) { |
28 | r += i + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9 + i10 + i11 + i12 + i13 + i14 + i15 + i16; |
29 | } |
30 | |
31 | int rf = 2216; |
32 | if (r != rf) { |
33 | fprintf(stderr, format: "r should be %d but instead equals %d\n", rf, r); |
34 | return 1; |
35 | } |
36 | |
37 | return 0; |
38 | } |
39 | |
40 |