2 ! { dg-options "-fcoarray=single" }
5 ! LOCK/LOCK_TYPE checks
11 type, extends(t) :: t2 ! { dg-error "coarray component, parent type .t. shall also have one" }
12 type(lock_type), allocatable :: c(:)[:]
14 end subroutine extends
20 type(lock_type), allocatable :: x(:)[:]
24 type(lock_type), allocatable :: x
30 type(lock_type), intent(out) :: x[*] ! OK
33 subroutine sub1(x) ! { dg-error "is INTENT.OUT. and can thus not be an allocatable coarray or have coarray components" }
35 type(lock_type), allocatable, intent(out) :: x(:)[:]
38 subroutine sub2(x) ! { dg-error "is INTENT.OUT. and can thus not be an allocatable coarray or have coarray components" }
40 type(t), intent(out) :: x
43 subroutine sub3(x) ! { dg-error "with coarray component shall be a nonpointer, nonallocatable scalar" }
45 type(t), intent(inout) :: x[*]
50 type(t2), intent(inout) :: x[*] ! OK
57 type(lock_type) :: lock ! { dg-error "type LOCK_TYPE must be a coarray" }
58 end subroutine lock_test
66 type(lock_type), save :: lock[*],lock2(2)[*]
67 lock(t) ! { dg-error "Syntax error in LOCK statement" }
68 lock(x) ! { dg-error "must be a scalar coarray of type LOCK_TYPE" }
71 lock(lock2) ! { dg-error "must be a scalar coarray of type LOCK_TYPE" }
73 end subroutine lock_test2
78 type(lock_type), save :: a[*], b[*]
79 a = b ! { dg-error "LOCK_TYPE in variable definition context" }
80 b = lock_type() ! { dg-error "LOCK_TYPE in variable definition context" }
81 print *, a ! { dg-error "cannot have PRIVATE components" }
82 end subroutine lock_test3
87 type(lock_type), allocatable :: A(:)[:]
90 lock(A(1), acquired_lock=ob)
93 end subroutine lock_test4
96 subroutine argument_check()
98 type(lock_type), SAVE :: ll[*]
99 call no_interface(ll) ! { dg-error "Actual argument of LOCK_TYPE or with LOCK_TYPE component at .1. requires an explicit interface" }
100 call test(ll) ! { dg-error "non-INTENT.INOUT. dummy .x. at .1., which is LOCK_TYPE or has a LOCK_TYPE component" }
103 type(lock_type), intent(in) :: x[*]
105 end subroutine argument_check
107 ! { dg-final { cleanup-modules "m" } }