[llvm] Stop including unordered_map (NFC)
[llvm-project.git] / openmp / runtime / test / tasking / task_reduction1.c
blob39712ea8f48c4004f7ae3d6d0e20a8bc887d63a5
1 // RUN: %libomp-compile-and-run
3 // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8
5 #include <stdio.h>
6 #include <stdlib.h>
8 int a = 0, b = 1;
10 int main(int argc, char **argv) {
12 #pragma omp parallel
13 #pragma omp single
15 #pragma omp taskgroup task_reduction(+: a) task_reduction(*: b)
17 int i;
18 for (i = 1; i <= 5; ++i) {
19 #pragma omp task in_reduction(+: a) in_reduction(*: b)
21 a += i;
22 b *= i;
23 #pragma omp task in_reduction(+: a)
25 a += i;
32 if (a != 30) {
33 fprintf(stderr, "error: a != 30. Instead a = %d\n", a);
34 exit(EXIT_FAILURE);
36 if (b != 120) {
37 fprintf(stderr, "error: b != 120. Instead b = %d\n", b);
38 exit(EXIT_FAILURE);
41 return EXIT_SUCCESS;