https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105242
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Why do you say accepts invalid for C/C++?
void
foo (int i1, int i2, int j1, int j2, int k1, int k2)
{
int k = 1;
#pragma omp target parallel for simd collapse(3) firstprivate (k)
for (int ii = i1; ii <= i2; ++ii)
for (int jj = j1; jj <= j2; ++jj)
for (int kk = k1; kk <= k2; ++kk)
{
if (kk > 5)
k = 0;
if (kk == 7)
break;
}
}
is certainly rejected:
pr105242.c: In function ‘foo’:
pr105242.c:13:13: error: break statement used with OpenMP for loop
13 | break;
| ^~~~~
by both C and C++ (all the way back to GCC 6).