aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-fortran/optional-data-copyin-by-value.f90
blob: 8e842980863857dd4d7dadc327fb0734a4d2a126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
! 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