OpenMP parallel reductions with barrier doesn't work
#include <stdio.h>
int main()
{
int x = 0;
#pragma omp parallel reduction(+: x)
{
#pragma omp barrier
x = 1;
}
printf("X: %d\n", x);
}
This code segfaults or doesn't compute the appropriate value. Seems like the barrier is computing the (unfinished) reduction.