| 1 |
! { dg-additional-options "-fdump-tree-original -fdump-tree-gimple" } |
| 2 |
|
| 3 |
program att |
| 4 |
implicit none |
| 5 |
type t |
| 6 |
integer :: arr1(10) |
| 7 |
integer, allocatable :: arr2(:) |
| 8 |
end type t |
| 9 |
type(t) :: myvar |
| 10 |
integer, target :: tarr(10) |
| 11 |
integer, pointer :: myptr(:) |
| 12 |
|
| 13 |
!$acc enter data attach(myvar%arr2, myptr) |
| 14 |
! { dg-final { scan-tree-dump-times "(?n)#pragma acc enter data map\\(attach:\\(integer\\(kind=4\\)\\\[0:\\\] \\* restrict\\) myvar\\.arr2\\.data \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(attach:\\(integer\\(kind=4\\)\\\[0:\\\] \\*\\) myptr\\.data \\\[bias: 0\\\]\\);$" 1 "original" } } |
| 15 |
! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_enter_data map\\(attach:myvar\\.arr2\\.data \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(attach:myptr\\.data \\\[bias: 0\\\]\\)$" 1 "gimple" } } |
| 16 |
|
| 17 |
!$acc exit data detach(myvar%arr2, myptr) |
| 18 |
! { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(detach:\\(integer\\(kind=4\\)\\\[0:\\\] \\* restrict\\) myvar\\.arr2\\.data \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(detach:\\(integer\\(kind=4\\)\\\[0:\\\] \\*\\) myptr\\.data \\\[bias: 0\\\]\\);$" 1 "original" } } |
| 19 |
! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(detach:myvar\\.arr2\\.data \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(detach:myptr\\.data \\\[bias: 0\\\]\\)$" 1 "gimple" } } |
| 20 |
|
| 21 |
! Test valid usage and processing of the finalize clause. |
| 22 |
!$acc exit data detach(myvar%arr2, myptr) finalize |
| 23 |
! { dg-final { scan-tree-dump-times "(?n)#pragma acc exit data map\\(detach:\\(integer\\(kind=4\\)\\\[0:\\\] \\* restrict\\) myvar\\.arr2\\.data \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(detach:\\(integer\\(kind=4\\)\\\[0:\\\] \\*\\) myptr\\.data \\\[bias: 0\\\]\\) finalize;$" 1 "original" } } |
| 24 |
! For array-descriptor detaches, we no longer generate a "release" mapping |
| 25 |
! for the pointed-to data for gimplify.c to turn into "delete". Make sure |
| 26 |
! the mapping still isn't there. |
| 27 |
! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_exit_data map\\(force_detach:myvar\\.arr2\\.data \\\[bias: 0\\\]\\) map\\(to:myptr \\\[pointer set, len: \[0-9\]+\\\]\\) map\\(force_detach:myptr\\.data \\\[bias: 0\\\]\\) finalize$" 1 "gimple" } } |
| 28 |
|
| 29 |
end program att |