[llvm] Stop including unordered_map (NFC)
[llvm-project.git] / openmp / runtime / test / tasking / task_reduction3.c
blobb125e3f6b38536e68e64d7979e3da1d8770bcf43
1 // RUN: %libomp-compile-and-run
3 // XFAIL: icc
4 // UNSUPPORTED: clang-4, clang-5, clang-6, clang-7, clang-8, clang-9, clang-10
5 // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8
7 #include <stdio.h>
8 #include <stdlib.h>
10 int a = 0, b = 1;
12 int main(int argc, char **argv) {
14 #pragma omp parallel
16 #pragma omp sections reduction(task, +: a) reduction(task, *: b)
18 #pragma omp section
20 #pragma omp task in_reduction(+: a) in_reduction(*: b)
22 a += 1;
23 b *= 1;
26 #pragma omp section
28 #pragma omp task in_reduction(+: a) in_reduction(*: b)
30 a += 2;
31 b *= 2;
34 #pragma omp section
36 #pragma omp task in_reduction(+: a) in_reduction(*: b)
38 a += 3;
39 b *= 3;
42 #pragma omp section
44 #pragma omp task in_reduction(+: a) in_reduction(*: b)
46 a += 4;
47 b *= 4;
50 #pragma omp section
52 #pragma omp task in_reduction(+: a) in_reduction(*: b)
54 a += 5;
55 b *= 5;
61 if (a != 15) {
62 fprintf(stderr, "error: a != 15. Instead a = %d\n", a);
63 exit(EXIT_FAILURE);
65 if (b != 120) {
66 fprintf(stderr, "error: b != 120. Instead b = %d\n", b);
67 exit(EXIT_FAILURE);
70 return EXIT_SUCCESS;