| 1 |
! { dg-additional-options "-DMEM_SHARED" { target offload_device_shared_as } } |
| 2 |
! { dg-do run } |
| 3 |
! |
| 4 |
! PR middle-end/94635 |
| 5 |
implicit none |
| 6 |
integer, parameter :: N = 20 |
| 7 |
integer, allocatable, dimension(:) :: my1DPtr |
| 8 |
integer, dimension(N) :: my1DArr |
| 9 |
integer :: i |
| 10 |
|
| 11 |
allocate(my1DPtr(N)) |
| 12 |
my1DPtr = 43 |
| 13 |
|
| 14 |
!$omp target enter data map(alloc: my1DPtr) |
| 15 |
!$omp target |
| 16 |
my1DPtr = [(i , i = 1, N)] |
| 17 |
!$omp end target |
| 18 |
|
| 19 |
!$omp target map(from: my1DArr) |
| 20 |
my1DArr = my1DPtr |
| 21 |
!$omp end target |
| 22 |
!$omp target exit data map(delete: my1DPtr) |
| 23 |
|
| 24 |
if (any (my1DArr /= [(i, i = 1, N)])) stop 1 |
| 25 |
#if MEM_SHARED |
| 26 |
if (any (my1DArr /= my1DPtr)) stop 2 |
| 27 |
#else |
| 28 |
if (any (43 /= my1DPtr)) stop 3 |
| 29 |
#endif |
| 30 |
|
| 31 |
my1DPtr = [(2*N-i, i = 1, N)] |
| 32 |
my1DArr = 42 |
| 33 |
|
| 34 |
!$omp target map(tofrom: my1DArr) map(tofrom: my1DPtr(:)) |
| 35 |
my1DArr = my1DPtr |
| 36 |
my1DPtr = 20 |
| 37 |
!$omp end target |
| 38 |
|
| 39 |
if (any (my1DArr /= [(2*N-i, i = 1, N)])) stop 4 |
| 40 |
if (any (20 /= my1DPtr)) stop 6 |
| 41 |
end |