| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fcoarray=single" } |
| 3 |
! |
| 4 |
! Constraint checks for invalid access of remote pointers |
| 5 |
! (Accessing the value is ok, checking/changing association |
| 6 |
! status is invalid) |
| 7 |
! |
| 8 |
! PR fortran/18918 |
| 9 |
! |
| 10 |
type t |
| 11 |
integer, pointer :: ptr => null() |
| 12 |
end type t |
| 13 |
type(t) :: x[*], y[*] |
| 14 |
|
| 15 |
if (associated(x%ptr)) stop 0 |
| 16 |
if (associated(x%ptr,y%ptr)) stop 0 |
| 17 |
|
| 18 |
if (associated(x[1]%ptr)) stop 0 ! { dg-error "shall not be coindexed" } |
| 19 |
if (associated(x%ptr,y[1]%ptr)) stop 0 ! { dg-error "shall not be coindexed" } |
| 20 |
|
| 21 |
nullify (x%ptr) |
| 22 |
nullify (x[1]%ptr) ! { dg-error "shall not be coindexed" } |
| 23 |
|
| 24 |
x%ptr => null(x%ptr) |
| 25 |
x%ptr => null(x[1]%ptr) ! { dg-error "shall not be coindexed" } |
| 26 |
x[1]%ptr => null(x%ptr) ! { dg-error "shall not have a coindex" } |
| 27 |
|
| 28 |
allocate(x%ptr) |
| 29 |
deallocate(x%ptr) |
| 30 |
|
| 31 |
allocate(x[1]%ptr) ! { dg-error "Coindexed allocatable object" } |
| 32 |
deallocate(x[1]%ptr) ! { dg-error "Coindexed allocatable object" } |
| 33 |
end |