Hi! I've realized there is UB in this testcase, because taskloop simd non-collapsed iterator is linear on simd, which implies lastprivate on taskloop, but with nogroup the last iteration's value might be stored when bar is out of scope already.
Fixed by declaring it in the construct, then nothing is written anywhere (other possibility would be private (i)). 2018-10-18 Jakub Jelinek <ja...@redhat.com> * testsuite/libgomp.c-c++-common/taskloop-reduction-3.c (bar): Define iterator inside of the construct. --- libgomp/testsuite/libgomp.c-c++-common/taskloop-reduction-3.c.jj 2018-10-18 13:49:18.531282016 +0200 +++ libgomp/testsuite/libgomp.c-c++-common/taskloop-reduction-3.c 2018-10-18 20:38:55.501725608 +0200 @@ -19,9 +19,8 @@ foo (void) __attribute__((noipa)) void bar (int x) { - int i; #pragma omp taskloop simd in_reduction (+:n) grainsize (64) nogroup - for (i = (x & 1) * (N / 2); i < (x & 1) * (N / 2) + (N / 2); i++) + for (int i = (x & 1) * (N / 2); i < (x & 1) * (N / 2) + (N / 2); i++) n += 2 * u[i]; } Jakub