1! { dg-do compile }
2! { dg-options "-fcoarray=single" }
3!
4! LOCK_TYPE checks
5!
6module m3
7  use iso_fortran_env
8  type, extends(lock_type) :: lock
9    integer :: j = 7
10  end type lock
11end module m3
12
13use m3
14type(lock_type) :: tl[*] = lock_type ()
15type(lock) :: t[*]
16tl = lock_type () ! { dg-error "variable definition context" }
17print *,t%j
18end
19
20subroutine test()
21  use iso_fortran_env
22  type t
23    type(lock_type) :: lock
24  end type t
25
26  type t2
27    type(t), pointer :: x ! { dg-error "Pointer component x at .1. has a noncoarray subcomponent of type LOCK_TYPE, which must have a codimension or be a subcomponent of a coarray" }
28  end type t2
29end subroutine test
30
31subroutine test2()
32  use iso_fortran_env
33  implicit none
34  type t
35    type(lock_type), allocatable :: lock ! { dg-error "Allocatable component lock at .1. of type LOCK_TYPE must have a codimension" }
36  end type t
37  type t2
38    type(lock_type) :: lock
39  end type t2
40  type t3
41    type(t2), allocatable :: lock_cmp
42  end type t3
43  type t4
44    integer, allocatable :: a[:]
45    type(t2) :: b ! { dg-error "Noncoarray component b at .1. of type LOCK_TYPE or with subcomponent of type LOCK_TYPE must have a codimension or be a subcomponent of a coarray. .Variables of type t4 may not have a codimension as already a coarray subcomponent exists." }
46  end type t4
47  type t5
48    type(t2) :: c ! { dg-error "Noncoarray component c at .1. of type LOCK_TYPE or with subcomponent of type LOCK_TYPE must have a codimension or be a subcomponent of a coarray. .Variables of type t5 may not have a codimension as d at .2. has a codimension or a coarray subcomponent." }
49    integer, allocatable :: d[:] ! { dg-error "Noncoarray component c at .1. of type LOCK_TYPE or with subcomponent of type LOCK_TYPE must have a codimension or be a subcomponent of a coarray. .Variables of type t5 may not have a codimension as d at .2. has a codimension or a coarray subcomponent." }
50  end type t5
51end subroutine test2
52