1! { dg-do compile } 2! { dg-options "-fcoarray=single" } 3! 4 5 6subroutine cont1(x) ! { dg-error "has the CONTIGUOUS attribute but is not an array pointer or an assumed-shape or assumed-rank array" } 7 type t 8 end type t 9 class(t), contiguous, allocatable :: x(:) 10end 11 12subroutine cont2(x) ! { dg-error "has the CONTIGUOUS attribute but is not an array pointer or an assumed-shape or assumed-rank array" } 13 type t 14 end type t 15 class(t), contiguous, allocatable :: x(:)[:] 16end 17 18subroutine cont3(x, y) 19 type t 20 end type t 21 class(t), contiguous, pointer :: x(:) 22 class(t), contiguous :: y(:) 23end 24 25function func() ! { dg-error "shall not be a coarray or have a coarray component" } 26 type t 27 end type t 28 class(t), allocatable :: func[*] 29end 30 31function func2() ! { dg-error "must be dummy, allocatable or pointer" } 32 type t 33 integer, allocatable :: caf[:] 34 end type t 35 class(t) :: func2a ! { dg-error "CLASS variable 'func2a' at .1. must be dummy, allocatable or pointer" } 36 class(t) :: func2 37end 38 39subroutine foo1(x1) ! { dg-error "Coarray variable 'x1' at .1. shall not have codimensions with deferred shape" } 40 type t 41 end type t 42 type(t) :: x1(:)[:] 43end 44 45subroutine foo2(x2) ! { dg-error "Coarray variable 'x2' at .1. shall not have codimensions with deferred shape" } 46 type t 47 end type t 48 type(t) :: x2[:] 49end 50 51 52! DITTO FOR CLASS 53 54subroutine foo3(x1) ! { dg-error "Coarray variable 'x1' at .1. shall not have codimensions with deferred shape" } 55 type t 56 end type t 57 class(t) :: x1(:)[:] 58end 59 60subroutine foo4(x2) ! { dg-error "Coarray variable 'x2' at .1. shall not have codimensions with deferred shape" } 61 type t 62 end type t 63 class(t) :: x2[:] 64end 65 66 67 68 69subroutine bar1(y1) ! { dg-error "Allocatable coarray variable 'y1' at .1. must have deferred shape" } 70 type t 71 end type t 72 type(t), allocatable :: y1(:)[5:*] 73end 74 75subroutine bar2(y2) ! { dg-error "Allocatable coarray variable 'y2' at .1. must have deferred shape" } 76 type t 77 end type t 78 type(t), allocatable :: y2[5:*] 79end 80 81subroutine bar3(z1) ! { dg-error "Allocatable coarray variable 'z1' at .1. must have deferred shape" } 82 type t 83 end type t 84 type(t), allocatable :: z1(5)[:] 85end 86 87subroutine bar4(z2) ! { dg-error "Allocatable array 'z2' at .1. must have a deferred shape" } 88 type t 89 end type t 90 type(t), allocatable :: z2(5) 91end subroutine bar4 92 93subroutine bar5(z3) ! { dg-error "Array pointer 'z3' at .1. must have a deferred shape" } 94 type t 95 end type t 96 type(t), pointer :: z3(5) 97end subroutine bar5 98 99 100 101 102! DITTO FOR CLASS 103 104subroutine bar1c(y1) ! { dg-error "Allocatable coarray variable 'y1' at .1. must have deferred shape" } 105 type t 106 end type t 107 class(t), allocatable :: y1(:)[5:*] 108end 109 110subroutine bar2c(y2) ! { dg-error "Allocatable coarray variable 'y2' at .1. must have deferred shape" } 111 type t 112 end type t 113 class(t), allocatable :: y2[5:*] 114end 115 116subroutine bar3c(z1) ! { dg-error "Allocatable coarray variable 'z1' at .1. must have deferred shape" } 117 type t 118 end type t 119 class(t), allocatable :: z1(5)[:] 120end 121 122subroutine bar4c(z2) ! { dg-error "Allocatable array 'z2' at .1. must have a deferred shape" } 123 type t 124 end type t 125 class(t), allocatable :: z2(5) 126end subroutine bar4c 127 128subroutine bar5c(z3) ! { dg-error "Array pointer 'z3' at .1. must have a deferred shape" } 129 type t 130 end type t 131 class(t), pointer :: z3(5) 132end subroutine bar5c 133 134 135subroutine sub() 136 type t 137 end type 138 type(t) :: a(5) 139 class(t), allocatable :: b(:) 140 call inter(a) 141 call inter(b) 142contains 143 subroutine inter(x) 144 class(t) :: x(5) 145 end subroutine inter 146end subroutine sub 147 148subroutine sub2() 149 type t 150 end type 151 type(t) :: a(5) 152contains 153 subroutine inter(x) 154 class(t) :: x(5) 155 end subroutine inter 156end subroutine sub2 157 158subroutine sub3() 159 type t 160 end type 161contains 162 subroutine inter2(x) ! { dg-error "must have a deferred shape" } 163 class(t), pointer :: x(5) 164 end subroutine inter2 165end subroutine sub3 166