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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #3)
> Created attachment 62608 [details] - Draft patch w/o testcases.

However, it regresses on the following testcase - with the inner metadirective
commented:

   17 |    do 55 i = 0, 5
Warning: Fortran 2018 deleted feature: Shared DO termination label 55 at (1)
   29 |       do 70 j = 0, 5
Warning: Fortran 2018 deleted feature: Shared DO termination label 70 at (1)


If one uncomments the inner metadirective, it starts failing with:
   10 |       do 50 j = 0, 5
   21 |       do 60 j = 0, 5
Error: Variable ā€˜j’ at (1) cannot be redefined inside loop beginning at (2)


Thus, there is clearly room for improvement of the draft patch ...


! Compile with: -fopenmp -Wall
(The one below is mixed, showing both diagnostic types as only one inner
metadiretive is commented out.)

implicit none
integer :: i, j
logical :: cond1, cond2
integer :: A(0:10,0:5), B(0:10,0:5)

cond1 = .true.
cond2 = .true.

!$omp metadirective when(user={condition(cond1)} : parallel do collapse(2))
      do 50 j = 0, 5
!!$omp  metadirective when(user={condition(.false.)} : simd)               
        do 51 i = 0, 10
          A(i,j) = i*10 + j
   51   continue
   50 continue

   do 55 i = 0, 5
   55 continue

!$omp begin metadirective when(user={condition(cond2)} : parallel do
collapse(2))
      do 60 j = 0, 5
!$omp  metadirective when(user={condition(.false.)} : simd)               
        do 61 i = 0, 10
          B(i,j) = i*10 + j
   61   continue
   60 continue
!$omp end metadirective

      do 70 j = 0, 5
      70 continue
end

Reply via email to