11586ed9c9
* testsuite/libgomp.fortran/use_device_addr-3.f90: Make 'stop' codes unique. * testsuite/libgomp.fortran/use_device_addr-4.f90: Ditto. * testsuite/libgomp.fortran/use_device_ptr-optional-2.f90: Ditto. * testsuite/libgomp.oacc-fortran/declare-5.f90: Ditto. * testsuite/libgomp.oacc-fortran/optional-data-copyin-by-value.f90: Ditto. * testsuite/libgomp.oacc-fortran/optional-firstprivate.f90: Ditto. * testsuite/libgomp.oacc-fortran/optional-update-host.f90: Ditto. From-SVN: r279117
30 lines
534 B
Fortran
30 lines
534 B
Fortran
! Test OpenACC data regions with optional arguments passed by value.
|
|
|
|
! { dg-do run }
|
|
|
|
program test
|
|
implicit none
|
|
|
|
integer :: res
|
|
|
|
if (foo(27) .ne. 27) stop 1
|
|
if (foo(16, 18) .ne. 288) stop 2
|
|
contains
|
|
function foo(x, y)
|
|
integer, value :: x
|
|
integer, value, optional :: y
|
|
integer :: res, foo
|
|
|
|
!$acc data copyin(x, y) copyout(res)
|
|
!$acc parallel
|
|
res = x
|
|
if (present(y)) then
|
|
res = res * y
|
|
end if
|
|
!$acc end parallel
|
|
!$acc end data
|
|
|
|
foo = res
|
|
end function foo
|
|
end program test
|