gcc/libgomp/testsuite/libgomp.oacc-fortran/non-scalar-data.f90
Thomas Schwinge 7fd549d24f OpenACC 2.5 default (present) clause
gcc/c/
	* c-parser.c (c_parser_omp_clause_default): Handle
	"OMP_CLAUSE_DEFAULT_PRESENT".
	gcc/cp/
	* parser.c (cp_parser_omp_clause_default): Handle
	"OMP_CLAUSE_DEFAULT_PRESENT".
	gcc/fortran/
	* gfortran.h (enum gfc_omp_default_sharing): Add
	"OMP_DEFAULT_PRESENT".
	* dump-parse-tree.c (show_omp_clauses): Handle it.
	* openmp.c (gfc_match_omp_clauses): Likewise.
	* trans-openmp.c (gfc_trans_omp_clauses): Likewise.
	gcc/
	* tree-core.h (enum omp_clause_default_kind): Add
	"OMP_CLAUSE_DEFAULT_PRESENT".
	* tree-pretty-print.c (dump_omp_clause): Handle it.
	* gimplify.c (enum gimplify_omp_var_data): Add
	"GOVD_MAP_FORCE_PRESENT".
	(gimplify_adjust_omp_clauses_1): Map it to
	"GOMP_MAP_FORCE_PRESENT".
	(oacc_default_clause): Handle "OMP_CLAUSE_DEFAULT_PRESENT".
	gcc/testsuite/
	* c-c++-common/goacc/default-1.c: Update.
	* c-c++-common/goacc/default-2.c: Likewise.
	* c-c++-common/goacc/default-4.c: Likewise.
	* gfortran.dg/goacc/default-1.f95: Likewise.
	* gfortran.dg/goacc/default-4.f: Likewise.
	* c-c++-common/goacc/default-5.c: New file.
	* gfortran.dg/goacc/default-5.f: Likewise.
	libgomp/
	* testsuite/libgomp.oacc-c++/template-reduction.C: Update.
	* testsuite/libgomp.oacc-c-c++-common/nested-2.c: Update.
	* testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/default-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/non-scalar-data.f90: Likewise.

From-SVN: r248280
2017-05-19 15:32:48 +02:00

93 lines
1.6 KiB
Fortran

! Ensure that a non-scalar dummy arguments which are implicitly used inside
! offloaded regions are properly mapped using present_or_copy, or (default)
! present.
! { dg-do run }
program main
implicit none
integer,parameter :: size = 100
integer :: array(size), i, n
n = size
!$acc data copy(array)
call kernels(array, n)
!$acc update host(array)
do i = 1, n
if (array(i) .ne. i) call abort
end do
call kernels_default_present(array, n)
!$acc update host(array)
do i = 1, n
if (array(i) .ne. i+1) call abort
end do
call parallel(array, n)
!$acc update host(array)
do i = 1, n
if (array(i) .ne. i+i) call abort
end do
call parallel_default_present(array, n)
!$acc end data
do i = 1, n
if (array(i) .ne. i+i+1) call abort
end do
end program main
subroutine kernels (array, n)
integer, dimension (n) :: array
integer :: n, i
!$acc kernels
do i = 1, n
array(i) = i
end do
!$acc end kernels
end subroutine kernels
subroutine kernels_default_present (array, n)
integer, dimension (n) :: array
integer :: n, i
!$acc kernels default(present)
do i = 1, n
array(i) = i+1
end do
!$acc end kernels
end subroutine kernels_default_present
subroutine parallel (array, n)
integer, dimension (n) :: array
integer :: n, i
!$acc parallel
do i = 1, n
array(i) = i+i
end do
!$acc end parallel
end subroutine parallel
subroutine parallel_default_present (array, n)
integer, dimension (n) :: array
integer :: n, i
!$acc parallel default(present)
do i = 1, n
array(i) = i+i+1
end do
!$acc end parallel
end subroutine parallel_default_present