gcc/libgomp/testsuite/libgomp.oacc-fortran/deep-copy-5.f90
Julian Brown 02817027ca OpenACC 2.6 deep copy: Fortran execution tests
libgomp/
	* testsuite/libgomp.oacc-fortran/deep-copy-1.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-2.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-3.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-4.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-5.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-6.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-7.f90: New test.
	* testsuite/libgomp.oacc-fortran/deep-copy-8.f90: New test.
	* testsuite/libgomp.oacc-fortran/derived-type-1.f90: New test.
	* testsuite/libgomp.oacc-fortran/derivedtype-1.f95: New test.
	* testsuite/libgomp.oacc-fortran/derivedtype-2.f95: New test.
	* testsuite/libgomp.oacc-fortran/multidim-slice.f95: New test.
	* testsuite/libgomp.oacc-fortran/update-2.f90: New test.

Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>

From-SVN: r279630
2019-12-20 01:39:46 +00:00

58 lines
979 B
Fortran

! { dg-do run }
! Test of attach/detach, "enter data" inside "data", and subarray.
program dtype
implicit none
integer, parameter :: n = 512
type mytype
integer, allocatable :: a(:)
integer, allocatable :: b(:)
end type mytype
integer i
type(mytype) :: var
allocate(var%a(1:n))
allocate(var%b(1:n))
!$acc data copy(var)
do i = 1, n
var%a(i) = 0
var%b(i) = 0
end do
!$acc enter data copyin(var%a(5:n - 5), var%b(5:n - 5))
!$acc parallel loop
do i = 5,n - 5
var%a(i) = i
var%b(i) = i * 2
end do
!$acc end parallel loop
!$acc exit data copyout(var%a(5:n - 5), var%b(5:n - 5))
!$acc end data
do i = 1,4
if (var%a(i) .ne. 0) stop 1
if (var%b(i) .ne. 0) stop 2
end do
do i = 5,n - 5
if (i .ne. var%a(i)) stop 3
if (i * 2 .ne. var%b(i)) stop 4
end do
do i = n - 4,n
if (var%a(i) .ne. 0) stop 5
if (var%b(i) .ne. 0) stop 6
end do
deallocate(var%a)
deallocate(var%b)
end program dtype