[Instrumentation] Fix a warning
[llvm-project.git] / openmp / runtime / test / tasking / task_reduction2.c
blob06a93b44dff14b7bf8dc5f439c34e8502eb9b809
1 // RUN: %libomp-compile-and-run
2 //
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 int i;
17 #pragma omp for reduction(task, +: a) reduction(task, *: b)
18 for (i = 1; i <= 5; ++i) {
19 #pragma omp task in_reduction(+: a) in_reduction(*: b)
21 a += i;
22 b *= i;
27 if (a != 15) {
28 fprintf(stderr, "error: a != 15. Instead a = %d\n", a);
29 exit(EXIT_FAILURE);
31 if (b != 120) {
32 fprintf(stderr, "error: b != 120. Instead b = %d\n", b);
33 exit(EXIT_FAILURE);
36 return EXIT_SUCCESS;