| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! Check whether registering allocatable coarrays works |
| 4 |
! |
| 5 |
type position |
| 6 |
real :: x, y, z |
| 7 |
end type position |
| 8 |
|
| 9 |
integer, allocatable :: a[:] |
| 10 |
type(position), allocatable :: p[:] |
| 11 |
|
| 12 |
allocate(a[*]) |
| 13 |
a = 7 |
| 14 |
|
| 15 |
allocate(p[*]) |
| 16 |
p%x = 11 |
| 17 |
p%y = 13 |
| 18 |
p%z = 15 |
| 19 |
|
| 20 |
if (a /= 7) STOP 1 |
| 21 |
a = 88 |
| 22 |
if (a /= 88) STOP 2 |
| 23 |
|
| 24 |
if (p%x /= 11) STOP 3 |
| 25 |
p%x = 17 |
| 26 |
if (p%x /= 17) STOP 4 |
| 27 |
|
| 28 |
block |
| 29 |
integer, allocatable :: b[:] |
| 30 |
|
| 31 |
allocate(b[*]) |
| 32 |
b = 8494 |
| 33 |
|
| 34 |
if (b /= 8494) STOP 5 |
| 35 |
end block |
| 36 |
|
| 37 |
if (a /= 88) STOP 6 |
| 38 |
call test () |
| 39 |
end |
| 40 |
|
| 41 |
subroutine test() |
| 42 |
type velocity |
| 43 |
real :: x, y, z |
| 44 |
end type velocity |
| 45 |
|
| 46 |
real, allocatable :: z[:] |
| 47 |
type(velocity), allocatable :: v[:] |
| 48 |
|
| 49 |
allocate(z[*]) |
| 50 |
z = sqrt(2.0) |
| 51 |
|
| 52 |
allocate(v[*]) |
| 53 |
v%x = 21 |
| 54 |
v%y = 23 |
| 55 |
v%z = 25 |
| 56 |
|
| 57 |
if (z /= sqrt(2.0)) STOP 7 |
| 58 |
if (v%x /= 21) STOP 8 |
| 59 |
|
| 60 |
end subroutine test |