| 1 |
! { dg-additional-options "-fopenmp-allocators" } |
| 2 |
module m |
| 3 |
implicit none (type, external) |
| 4 |
type t |
| 5 |
integer, allocatable :: Acomp, Bcomp(:) |
| 6 |
end type t |
| 7 |
|
| 8 |
contains |
| 9 |
|
| 10 |
subroutine intent_out(aa, bb, cc, dd, ee, ff) |
| 11 |
integer, allocatable,intent(out) :: aa, bb(:) |
| 12 |
type(t), intent(out) :: cc, dd(4) |
| 13 |
type(t), allocatable, intent(out) :: ee, ff(:) |
| 14 |
end |
| 15 |
|
| 16 |
subroutine q(qa, qb, qc, qd, qe, qf) |
| 17 |
integer, allocatable :: qa, qb(:) |
| 18 |
type(t) :: qc, qd(4) |
| 19 |
type(t), allocatable :: qe, qf(:) |
| 20 |
call intent_out (qa, qb, qc, qd, qe, qf) |
| 21 |
end subroutine q |
| 22 |
|
| 23 |
subroutine r |
| 24 |
integer, allocatable :: r1, r2(:) |
| 25 |
type(t) :: r3, r4(4) |
| 26 |
type(t), allocatable :: r5, r6(:) |
| 27 |
|
| 28 |
call q(r1,r2,r3,r4,r5,r6) |
| 29 |
|
| 30 |
allocate(r1,r2(3)) |
| 31 |
allocate(r5,r6(4)) |
| 32 |
allocate(r3%Acomp, r3%Bcomp(2)) |
| 33 |
allocate(r4(2)%Acomp, r4(2)%Bcomp(2)) |
| 34 |
allocate(r5%Acomp, r5%Bcomp(2)) |
| 35 |
allocate(r6(3)%Acomp, r6(3)%Bcomp(2)) |
| 36 |
!$omp allocate align(128) |
| 37 |
allocate(r4(3)%Acomp, r4(3)%Bcomp(2), & |
| 38 |
r6(1)%Acomp, r6(1)%Bcomp(2)) |
| 39 |
if (mod (loc (r4(3)%Acomp), 128) /= 0) stop 1 |
| 40 |
if (mod (loc (r4(3)%Bcomp), 128) /= 0) stop 2 |
| 41 |
if (mod (loc (r6(1)%Acomp), 128) /= 0) stop 3 |
| 42 |
if (mod (loc (r6(1)%Bcomp), 128) /= 0) stop 3 |
| 43 |
call q(r1,r2,r3,r4,r5,r6) |
| 44 |
|
| 45 |
!$omp allocate align(64) |
| 46 |
allocate(r1,r2(3)) |
| 47 |
if (mod (loc (r1), 64) /= 0) stop 1 |
| 48 |
if (mod (loc (r2), 64) /= 0) stop 1 |
| 49 |
!$omp allocate align(64) |
| 50 |
allocate(r5,r6(4)) |
| 51 |
if (mod (loc (r5), 64) /= 0) stop 1 |
| 52 |
if (mod (loc (r6), 64) /= 0) stop 1 |
| 53 |
!$omp allocate align(64) |
| 54 |
allocate(r3%Acomp, r3%Bcomp(2)) |
| 55 |
if (mod (loc (r3%Acomp), 64) /= 0) stop 1 |
| 56 |
if (mod (loc (r3%Bcomp), 64) /= 0) stop 1 |
| 57 |
!$omp allocate align(64) |
| 58 |
allocate(r4(2)%Acomp, r4(2)%Bcomp(2)) |
| 59 |
if (mod (loc (r4(2)%Acomp), 64) /= 0) stop 1 |
| 60 |
if (mod (loc (r4(2)%Bcomp), 64) /= 0) stop 1 |
| 61 |
!$omp allocate align(64) |
| 62 |
allocate(r5%Acomp, r5%Bcomp(2)) |
| 63 |
if (mod (loc (r5%Acomp), 64) /= 0) stop 1 |
| 64 |
if (mod (loc (r5%Bcomp), 64) /= 0) stop 1 |
| 65 |
!$omp allocate align(64) |
| 66 |
allocate(r6(3)%Acomp, r6(3)%Bcomp(2)) |
| 67 |
if (mod (loc (r6(3)%Acomp), 64) /= 0) stop 1 |
| 68 |
if (mod (loc (r6(3)%Bcomp), 64) /= 0) stop 1 |
| 69 |
!$omp allocate align(128) |
| 70 |
allocate(r4(3)%Acomp, r4(3)%Bcomp(2), & |
| 71 |
r6(1)%Acomp, r6(1)%Bcomp(2)) |
| 72 |
if (mod (loc (r4(3)%Acomp), 128) /= 0) stop 1 |
| 73 |
if (mod (loc (r4(3)%Bcomp), 128) /= 0) stop 2 |
| 74 |
if (mod (loc (r6(1)%Acomp), 128) /= 0) stop 3 |
| 75 |
if (mod (loc (r6(1)%Bcomp), 128) /= 0) stop 3 |
| 76 |
call q(r1,r2,r3,r4,r5,r6) |
| 77 |
end subroutine r |
| 78 |
end |
| 79 |
|
| 80 |
subroutine s |
| 81 |
use m, only : t |
| 82 |
implicit none (type, external) |
| 83 |
type(t) :: xx |
| 84 |
integer :: i, iiiiii |
| 85 |
i = 4 |
| 86 |
!$omp allocate |
| 87 |
allocate(xx%Acomp, xx%Bcomp(4)) |
| 88 |
deallocate(xx%Acomp, xx%Bcomp) |
| 89 |
|
| 90 |
!$omp allocate |
| 91 |
allocate(xx%Acomp, xx%Bcomp(4)) |
| 92 |
xx = t(1, [1,2]) |
| 93 |
end |
| 94 |
|
| 95 |
program main |
| 96 |
use m, only: r |
| 97 |
implicit none (type, external) |
| 98 |
external s |
| 99 |
call s |
| 100 |
call r |
| 101 |
end |