Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
! Offloading test checking interaction of an
! implicit derived type mapping when mapped
! to target and assinging one derived type
! to another
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar
integer(4) :: ix = 0
real(4) :: rx = 0.0
complex(4) :: zx = (0,0)
end type scalar

type(scalar) :: in
type(scalar) :: out
in%ix = 10
in%rx = 2.0
in%zx = (2, 10)

!$omp target map(from:out)
out = in
!$omp end target

print*, in%ix
print*, in%rx
write (*,*) in%zx

print*, out%ix
print*, out%rx
write (*,*) out%zx
end program main

!CHECK: 10
!CHECK: 2.
!CHECK: (2.,10.)
!CHECK: 10
!CHECK: 2.
!CHECK: (2.,10.)

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
! Offloading test checking interaction of an
! explicit derived type mapping when mapped
! to target and assinging one derived type
! to another
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar
integer(4) :: ix = 0
real(4) :: rx = 0.0
complex(4) :: zx = (0,0)
integer(4) :: array(5)
end type scalar

type(scalar) :: out
type(scalar) :: in

in%ix = 10
in%rx = 2.0
in%zx = (2, 10)

do i = 1, 5
in%array(i) = i
end do

!$omp target
out%ix = in%ix
out%rx = in%rx
out%zx = in%zx

do i = 1, 5
out%array(i) = in%array(i)
end do
!$omp end target

print*, in%ix
print*, in%rx
print*, in%array
write (*,*) in%zx

print*, out%ix
print*, out%rx
print*, out%array
write (*,*) out%zx
end program main

!CHECK: 10
!CHECK: 2.
!CHECK: 1 2 3 4 5
!CHECK: (2.,10.)
!CHECK: 10
!CHECK: 2.
!CHECK: 1 2 3 4 5
!CHECK: (2.,10.)
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
! Offloading test checking interaction of an
! explicit derived type member mapping of
! an array with bounds when mapped to
! target using a combination of update,
! enter and exit directives.
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar_array
integer(4) :: array(10)
end type scalar_array

type(scalar_array) :: scalar_arr

do I = 1, 10
scalar_arr%array(I) = I + I
end do

!$omp target enter data map(to: scalar_arr%array(3:6))

! overwrite our target data with an update.
do I = 1, 10
scalar_arr%array(I) = 10
end do

!$omp target update to(scalar_arr%array(3:6))

! The compiler/runtime is less friendly about read/write out of
! bounds when using enter and exit, we have to specifically loop
! over the correct range
!$omp target
do i=3,6
scalar_arr%array(i) = scalar_arr%array(i) + i
end do
!$omp end target

!$omp target exit data map(from: scalar_arr%array(3:6))

print*, scalar_arr%array
end program

!CHECK: 10 10 13 14 15 16 10 10 10 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
! Offloading test checking interaction of an
! explicit derived type member mapping of
! an array with bounds when mapped to
! target using a combination of enter and
! exit directives.
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar_array
integer(4) :: array(10)
end type scalar_array

type(scalar_array) :: scalar_arr

do I = 1, 10
scalar_arr%array(I) = I + I
end do

!$omp target enter data map(to: scalar_arr%array(3:6))

! Shouldn't overwrite data already locked in
! on target via enter, which will then be
! overwritten by our exit
do I = 1, 10
scalar_arr%array(I) = 10
end do

! The compiler/runtime is less friendly about read/write out of
! bounds when using enter and exit, we have to specifically loop
! over the correct range
!$omp target
do i=3,6
scalar_arr%array(i) = scalar_arr%array(i) + i
end do
!$omp end target

!$omp target exit data map(from: scalar_arr%array(3:6))

print*, scalar_arr%array
end program

!CHECK: 10 10 9 12 15 18 10 10 10 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
! Offloading test checking interaction of an
! explicit derived type member mapping of
! an array when mapped to target
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar_array
real(4) :: break_0
real(4) :: array_x(10)
real(4) :: break_1
real(4) :: array_y(10)
real(4) :: break_3
end type scalar_array

type(scalar_array) :: scalar_arr

!$omp target map(tofrom:scalar_arr%array_y)
do i = 1, 10
scalar_arr%array_y(i) = i
end do
!$omp end target

print *, scalar_arr%array_y
end program main

!CHECK: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
! Offloading test checking interaction of an
! explicit derived type member mapping of
! two arrays with explicit bounds when
! mapped to target
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar_array
real(4) :: break_0
integer(4) :: array_x(3,3,3)
real(4) :: break_1
integer(4) :: array_y(3,3,3)
real(4) :: break_3
end type scalar_array

type(scalar_array) :: scalar_arr

do i = 1, 3
do j = 1, 3
do k = 1, 3
scalar_arr%array_x(i, j, k) = 42
scalar_arr%array_y(i, j, k) = 0 ! Will get overwritten by garbage values in target
end do
end do
end do

!$omp target map(tofrom:scalar_arr%array_x(1:3, 1:3, 2:2), scalar_arr%array_y(1:3, 1:3, 1:3))
do j = 1, 3
do k = 1, 3
scalar_arr%array_y(k, j, 2) = scalar_arr%array_x(k, j, 2)
end do
end do
!$omp end target

print *, scalar_arr%array_y
end program main

!CHECK: 0 0 0 0 0 0 0 0 0 42 42 42 42 42 42 42 42 42 0 0 0 0 0 0 0 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
! Offloading test checking interaction of an
! explicit derived type member mapping of
! two arrays with explicit bounds when
! mapped to target
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar_array
real(4) :: break_0
real(4) :: array_x(10)
real(4) :: break_1
real(4) :: array_y(10)
real(4) :: break_3
end type scalar_array

type(scalar_array) :: scalar_arr

do i = 1, 10
scalar_arr%array_x(i) = i
end do

!$omp target map(tofrom:scalar_arr%array_x(3:6), scalar_arr%array_y(3:6))
do i = 1, 10
scalar_arr%array_y(i) = scalar_arr%array_x(i)
end do
!$omp end target

print*, scalar_arr%array_y
end program main

!CHECK: 0. 0. 3. 4. 5. 6. 0. 0. 0. 0.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
! Offloading test checking interaction of an
! derived type mapping of two explicit array
! members to target
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar_array
real(4) :: break_0
real(4) :: array_x(10)
real(4) :: break_1
real(4) :: array_y(10)
real(4) :: break_3
end type scalar_array

type(scalar_array) :: scalar_arr

do i = 1, 10
scalar_arr%array_x(i) = i
end do

!$omp target map(tofrom:scalar_arr%array_x, scalar_arr%array_y)
do i = 1, 10
scalar_arr%array_y(i) = scalar_arr%array_x(i)
end do
!$omp end target

print*, scalar_arr%array_x
print*, scalar_arr%array_y
end program main

!CHECK: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
!CHECK: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
! Offloading test checking interaction of an
! derived type mapping of two explicit
! members to target
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar
integer(4) :: ix = 0
real(4) :: rx = 0.0
complex(4) :: zx = (0,0)
real(4) :: ry = 1.0
end type scalar

type(scalar) :: scalar_struct

!$omp target map(from:scalar_struct%rx, scalar_struct%ry)
scalar_struct%rx = 21.0
scalar_struct%ry = 27.0
!$omp end target

print*, scalar_struct%rx
print*, scalar_struct%ry
end program main

!CHECK: 21.
!CHECK: 27.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
! Offloading test checking interaction of an
! enter and exit map of an array of scalars
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
integer :: array(10)

do I = 1, 10
array(I) = I + I
end do

!$omp target enter data map(to: array)

! Shouldn't overwrite data already locked in
! on target via enter, this will then be
! overwritten by our exit
do I = 1, 10
array(I) = 10
end do

!$omp target
do i=1,10
array(i) = array(i) + i
end do
!$omp end target

!$omp target exit data map(from: array)

print*, array
end program

!CHECK: 3 6 9 12 15 18 21 24 27 30
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
! Offloading test checking interaction of an
! enter and exit map of an array of scalars
! with specified bounds
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic

program main
integer :: array(10)

do I = 1, 10
array(I) = I + I
end do

!$omp target enter data map(to: array(3:6))

! Shouldn't overwrite data already locked in
! on target via enter, which will then be
! overwritten by our exit
do I = 1, 10
array(I) = 10
end do

! The compiler/runtime is less lenient about read/write out of
! bounds when using enter and exit, we have to specifically loop
! over the correctly mapped range
!$omp target
do i=3,6
array(i) = array(i) + i
end do
!$omp end target

!$omp target exit data map(from: array(3:6))

print *, array
end program

!CHECK: 10 10 9 12 15 18 10 10 10 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
! Offloading test checking interaction of an
! enter and exit map of an scalar
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
integer :: scalar
scalar = 10

!$omp target enter data map(to: scalar)

!ignored, as we've already attached
scalar = 20

!$omp target
scalar = scalar + 50
!$omp end target

!$omp target exit data map(from: scalar)

! not the answer one may expect, but it is the same
! answer Clang gives so we are correctly on par with
! Clang for the moment.
print *, scalar
end program

!CHECK: 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
! Offloading test checking interaction of an
! single explicit member map from a single
! derived type.
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
real :: test
type :: scalar
integer(4) :: ix = 0
real(4) :: rx = 0.0
complex(4) :: zx = (0,0)
real(4) :: ry = 1.0
end type scalar

type(scalar) :: scalar_struct
scalar_struct%rx = 2.0
test = 21.0

!$omp target map(from:scalar_struct%rx)
scalar_struct%rx = test
!$omp end target

print *, scalar_struct%rx
end program main

!CHECK: 21.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
! Offloading test checking interaction of two
! derived type's with one explicit member
! each being mapped with bounds to target
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar_array
real(4) :: break_0
real(4) :: array_x(10)
real(4) :: break_1
real(4) :: array_y(10)
real(4) :: break_3
end type scalar_array

type(scalar_array) :: scalar_arr1
type(scalar_array) :: scalar_arr2

!$omp target map(tofrom:scalar_arr1%break_1, scalar_arr2%break_3)
scalar_arr2%break_3 = 10
scalar_arr1%break_1 = 15
!$omp end target

print*, scalar_arr1%break_1
print*, scalar_arr2%break_3
end program main

!CHECK: 15.
!CHECK: 10.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
! Offloading test checking interaction of two
! derived type's with a single explicit array
! member each being mapped with bounds to
! target
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar_array
real(4) :: break_0
real(4) :: array_x(10)
real(4) :: break_1
real(4) :: array_y(10)
real(4) :: break_3
end type scalar_array

type(scalar_array) :: scalar_arr1
type(scalar_array) :: scalar_arr2


!$omp target map(tofrom:scalar_arr1%array_x(3:6), scalar_arr2%array_x(3:6))
do i = 1, 10
scalar_arr2%array_x(i) = i
scalar_arr1%array_x(i) = i
end do
!$omp end target

print*, scalar_arr1%array_x
print*, scalar_arr2%array_x
end program main

!CHECK: 0. 0. 3. 4. 5. 6. 0. 0. 0. 0.
!CHECK: 0. 0. 3. 4. 5. 6. 0. 0. 0. 0.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
! Offloading test checking interaction of two
! derived type's with a mix of explicit and
! implicit member mapping to target
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar_array
real(4) :: break_0
real(4) :: array_x(10)
real(4) :: break_1
real(4) :: array_y(10)
real(4) :: break_3
end type scalar_array

type(scalar_array) :: scalar_arr1
type(scalar_array) :: scalar_arr2

!$omp target map(tofrom:scalar_arr1%break_1)
scalar_arr2%break_3 = 10
scalar_arr1%break_1 = 15
!$omp end target

print*, scalar_arr1%break_1
print*, scalar_arr2%break_3
end program main

!CHECK: 15.
!CHECK: 10.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
! Offloading test checking interaction of two
! derived type's with a mix of explicit and
! implicit member mapping of arrays to target
! one with bounds.
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar_array
real(4) :: break_0
real(4) :: array_x(10)
real(4) :: break_1
real(4) :: array_y(10)
real(4) :: break_3
end type scalar_array

type(scalar_array) :: scalar_arr1
type(scalar_array) :: scalar_arr2

do i = 1, 10
scalar_arr1%array_x(i) = i
end do

!$omp target map(tofrom:scalar_arr2%array_x(3:6))
do i = 1, 10
scalar_arr2%array_x(i) = scalar_arr1%array_x(i)
end do
!$omp end target

print*, scalar_arr1%array_x
print*, scalar_arr2%array_x
end program main

!CHECK: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
!CHECK: 0. 0. 3. 4. 5. 6. 0. 0. 0. 0.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
! Offloading test checking interaction of two
! derived type's with two explicit array
! members each being mapped with bounds to
! target
! REQUIRES: flang, amdgcn-amd-amdhsa
! UNSUPPORTED: nvptx64-nvidia-cuda
! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
! UNSUPPORTED: aarch64-unknown-linux-gnu
! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
! UNSUPPORTED: x86_64-pc-linux-gnu
! UNSUPPORTED: x86_64-pc-linux-gnu-LTO

! RUN: %libomptarget-compile-fortran-run-and-check-generic
program main
type :: scalar_array
real(4) :: break_0
real(4) :: array_x(10)
real(4) :: break_1
real(4) :: array_y(10)
real(4) :: break_3
end type scalar_array

type(scalar_array) :: scalar_arr1
type(scalar_array) :: scalar_arr2

do i = 1, 10
scalar_arr1%array_x(i) = i
scalar_arr2%array_x(i) = i
end do

!$omp target map(tofrom:scalar_arr1%array_x(3:6), scalar_arr1%array_y(3:6), scalar_arr2%array_x(3:6), scalar_arr2%array_y(3:6))
do i = 1, 10
scalar_arr2%array_y(i) = scalar_arr1%array_x(i)
end do

do i = 1, 10
scalar_arr1%array_y(i) = scalar_arr2%array_x(i)
end do
!$omp end target

print*, scalar_arr1%array_x
print*, scalar_arr2%array_y

print*, scalar_arr2%array_x
print*, scalar_arr1%array_y
end program main

!CHECK: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
!CHECK: 0. 0. 3. 4. 5. 6. 0. 0. 0. 0.
!CHECK: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
!CHECK: 0. 0. 3. 4. 5. 6. 0. 0. 0. 0.