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! 10type t 11 integer, pointer :: ptr => null() 12end type t 13type(t) :: x[*], y[*] 14 15if (associated(x%ptr)) stop 0 16if (associated(x%ptr,y%ptr)) stop 0 17 18if (associated(x[1]%ptr)) stop 0 ! { dg-error "shall not be coindexed" } 19if (associated(x%ptr,y[1]%ptr)) stop 0 ! { dg-error "shall not be coindexed" } 20 21nullify (x%ptr) 22nullify (x[1]%ptr) ! { dg-error "shall not be coindexed" } 23 24x%ptr => null(x%ptr) 25x%ptr => null(x[1]%ptr) ! { dg-error "shall not be coindexed" } 26x[1]%ptr => null(x%ptr) ! { dg-error "shall not have a coindex" } 27 28allocate(x%ptr) 29deallocate(x%ptr) 30 31allocate(x[1]%ptr) ! { dg-error "Coindexed allocatable object" } 32deallocate(x[1]%ptr) ! { dg-error "Coindexed allocatable object" } 33end 34