| 1 |
implicit none |
| 2 |
integer, allocatable :: x(:) |
| 3 |
x = [1,2,3,4] |
| 4 |
call foo(x) |
| 5 |
if (any (x /= [1,2,3,4])) error stop |
| 6 |
call foo() |
| 7 |
contains |
| 8 |
subroutine foo(c) |
| 9 |
integer, allocatable, optional :: c(:) |
| 10 |
logical :: is_present |
| 11 |
is_present = present (c) |
| 12 |
!$omp target firstprivate(c) |
| 13 |
if (is_present) then |
| 14 |
if (.not. allocated(c)) error stop |
| 15 |
if (any (c /= [1,2,3,4])) error stop |
| 16 |
c = [99,88,77,66] |
| 17 |
if (any (c /= [99,88,77,66])) error stop |
| 18 |
end if |
| 19 |
!$omp end target |
| 20 |
if (is_present) then |
| 21 |
if (any (c /= [1,2,3,4])) error stop |
| 22 |
end if |
| 23 |
end |
| 24 |
end |