| 1 |
! { dg-additional-options "-O3" } |
| 2 |
! |
| 3 |
! With -O3 the static local variable A.10 generated for |
| 4 |
! the array constructor [-2, -4, ..., -20] is optimized |
| 5 |
! away - which has to be handled in the offload_vars table. |
| 6 |
! |
| 7 |
program main |
| 8 |
implicit none (type, external) |
| 9 |
integer :: j |
| 10 |
integer, allocatable :: A(:) |
| 11 |
|
| 12 |
A = [(3*j, j=1, 10)] |
| 13 |
call bar (A) |
| 14 |
deallocate (A) |
| 15 |
contains |
| 16 |
subroutine bar (array) |
| 17 |
integer :: i |
| 18 |
integer :: array(:) |
| 19 |
|
| 20 |
!$omp target map(from:array) |
| 21 |
!$acc parallel copyout(array) |
| 22 |
array = [(-2*i, i = 1, size(array))] |
| 23 |
!$omp do private(array) |
| 24 |
!$acc loop gang private(array) |
| 25 |
do i = 1, 10 |
| 26 |
array(i) = 9*i |
| 27 |
end do |
| 28 |
if (any (array /= [(-2*i, i = 1, 10)])) error stop 2 |
| 29 |
!$omp end target |
| 30 |
!$acc end parallel |
| 31 |
end subroutine bar |
| 32 |
end |