1! { dg-do run } 2! 3! PR fortran/94690 4! PR middle-end/66199 5 6module m 7 implicit none 8 integer :: u(0:1023), v(0:1023), w(0:1023) 9 !$omp declare target (u, v, w) 10 11contains 12 13integer function f2 (a, b, c) 14 integer :: a, b, c, d, e 15 !$omp target map(from: d, e) 16 !$omp teams distribute parallel do default(none) firstprivate (a, b, c) shared(u, v, w) lastprivate(d, e) 17 do d = a, b-1 18 u(d) = v(d) + w(d) 19 e = c + d * 5 20 end do 21 !$omp end target 22 f2 = d + e 23end 24 25integer function f3 (a1, b1, a2, b2) 26 integer :: a1, b1, a2, b2, d1, d2 27 !$omp target map(from: d1, d2) 28 !$omp teams distribute parallel do default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2) 29 do d1 = a1, b1-1 30 do d2 = a2, b2-1 31 u(d1 * 32 + d2) = v(d1 * 32 + d2) + w(d1 * 32 + d2) 32 end do 33 end do 34 !$omp end target 35 f3 = d1 + d2 36end 37end module m 38 39use m 40 if (f2 (0, 1024, 17) /= 1024 + (17 + 5 * 1023)) stop 1 41 if (f3 (0, 32, 0, 32) /= 64) stop 2 42end 43