When compiling the following testcase with OpenMP enabled
! t.f90
subroutine p(n, k)
implicit none
integer :: i
integer :: j
integer :: n
integer :: k(10, 10)
!$omp task private(i, j) shared(k)
forall(i=1:10, j=1:10) k(i, j) = 0
!$omp end task
end subroutine p
the following diagnostics are emitted
$ flang-new -c t.f90 -fopenmp
./t.f90:10:25: warning: FORALL index variable 'i' not used on left-hand side of assignment
forall(i=1:10, j=1:10) k(i, j) = 0
^^^^^^^^^^^
./t.f90:10:25: warning: FORALL index variable 'j' not used on left-hand side of assignment
forall(i=1:10, j=1:10) k(i, j) = 0
^^^^^^^^^^^
but the variables are indeed used.
The diagnostic is not emitted if OpenMP is not enabled.
When compiling the following testcase with OpenMP enabled
the following diagnostics are emitted
but the variables are indeed used.
The diagnostic is not emitted if OpenMP is not enabled.