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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Minimal example openmp:
...
program main
  implicit none
  integer :: i, j, k
  integer :: n = 2
  real :: a(2), c(2,2), cc(2,2)

  a = 0.5

  cc = 0
  do j = 1, n
    do k = 1, n
      do i = 1, n
        cc(i,j) = a(k) + cc(i,j)
      end do
    end do
  end do

  c = 0
  !$omp target teams distribute parallel do collapse(3) map( to:a) map(
tofrom:c )
  do j = 1, n
    do k = 1, n
      do i = 1, n
            c(i,j) = a(k) + c(i,j)
      end do
    end do
  end do

  print *, "CC (host):"
  print '(2(f8.1,x))', cc

  print *, "C (target):"
  print '(2(f8.1,x))', c

end program main
...

Gives:
...
 CC (host):
     1.0      1.0
     1.0      1.0
 C (target):
     1.0      0.5
     1.0      1.0
...
or:
...
 CC (host):
     1.0      1.0
     1.0      1.0
 C (target):
     1.0      0.5
     0.5      1.0
...

Reply via email to