https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121452

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #2)
> (In reply to Tobias Burnus from comment #1)
> > !$omp for ordered(2)
> >    do i = 1, 5
> >      do j = 1, 5
> 
> Correction: 'for' → 'do', 'do i' → 'do 10 i' and 'do j' → 'do 20 j'.
> 
> This one actually fails already in the front end:
>   Error: !$OMP DO inner loops must be perfectly nested with ORDERED clause
> at (1)

[TODO] Needs to be fixed.

I wonder whether we need this front-end check – or whether it can be done later
in the middle end - as seemingly the case for C. If we keep it, it needs to be
fixed.

* * *

Same issue in C/C++ for the following code - which seems to be valid.
[TODO] Error (1) needs to be handled (the other is covered)

void f(int *A, int *B)
{
  #pragma omp simd collapse(2)
  for (int i=0; i < 1; i++) {
q:   // Error (1)
    for (int j=0; j < 1; j++)
      A[i] += B[j];
r:   // Error (2) → fixed by the patch in comment 2
     // label variant of C version of intervening code of comment 0
  }
}

Namely:
(1) error: loop not permitted in intervening code in OpenMP loop body
(2) error: OpenMP constructs other than ‘ordered simd’, ‘simd’, ‘loop’ or
‘atomic’ may not be nested inside ‘simd’ region

Reply via email to