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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #1)
>   if (fd->collapse > 1
>       && (gimple_omp_for_combined_into_p (fd->for_stmt)
>           || broken_loop))

Commenting the '&& (...)' condition does not help with SPECaccel 2013's
455.seismic - and might be a red herring.

* * *

The testcase below might be better as it shows a warning with -O1
and higher:

subroutine foo(vv,NX, NY, NZ)
implicit none
double precision, allocatable, dimension(:,:,:) :: vv
integer :: NX, NY, NZ 
integer :: k, j, i
i = 0; j = 0; k = 0

!$omp target map(tofrom:k,j,i)     ! - if commented, no warning
!!$omp target firstprivate(k,j,i)  ! - if used instead, no warning
block
!$omp do simd collapse(3) ! - warning: ‘.count.20’ may be used uninitialized
                          ! but only with 'target + map'
  do k=1, NZ
     do j=2, NY-1
        do i=1, NX
           vv(i,j,k) = 0.0d0
        enddo
     enddo
  enddo
end block
end


Same result with:
  !$omp target do simd collapse(3)
as the implied 'lastprivate(k,j,i)' implies 'map(tofrom:k,j,i)',
and the 'lastprivate' is implied because: "The loop-iteration variable in any
affected loop of a loop or simd construct is lastprivate."

Reply via email to