https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99007
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Simplified testcase, no need for templates, and no need for UB in the code and no need for C++: void bar (int n) { long s[n]; #pragma omp teams distribute parallel for reduction(+:s) allocate(s) for (int i = 0; i < 8; i++) ; }