1! Test OpenACC data regions with optional arguments passed by value.
2
3! { dg-do run }
4
5program test
6  implicit none
7
8  integer :: res
9
10  if (foo(27) .ne. 27) stop 1
11  if (foo(16, 18) .ne. 288) stop 2
12contains
13  function foo(x, y)
14    integer, value :: x
15    integer, value, optional :: y
16    integer :: res, foo
17
18    !$acc data copyin(x, y) copyout(res)
19    !$acc parallel
20    res = x
21    if (present(y)) then
22      res = res * y
23    end if
24    !$acc end parallel
25    !$acc end data
26
27    foo = res
28  end function foo
29end program test
30