2 ! { dg-options "-fcoarray=lib -lcaf_single" }
6 ! this_image(coarray) run test,
7 ! expecially for num_images > 1
9 ! Tested are values up to num_images == 8,
10 ! higher values are OK, but not tested for
13 integer :: a(1)[2:2, 3:4, 7:*]
14 integer :: b(:)[:, :,:]
18 if (this_image(A, dim=1) /= 2) call abort()
20 if (this_image(A, dim=i) /= 2) call abort()
22 select case (this_image())
24 if (this_image(A, dim=2) /= 3) call abort()
25 if (this_image(A, dim=3) /= 7) call abort()
27 if (this_image(A, dim=i) /= 3) call abort()
29 if (this_image(A, dim=i) /= 7) call abort()
30 if (any (this_image(A) /= [2,3,7])) call abort()
33 if (this_image(A, dim=2) /= 4) call abort()
34 if (this_image(A, dim=3) /= 7) call abort()
36 if (this_image(A, dim=i) /= 4) call abort()
38 if (this_image(A, dim=i) /= 7) call abort()
39 if (any (this_image(A) /= [2,4,7])) call abort()
42 if (this_image(A, dim=2) /= 3) call abort()
43 if (this_image(A, dim=3) /= 8) call abort()
45 if (this_image(A, dim=i) /= 3) call abort()
47 if (this_image(A, dim=i) /= 8) call abort()
48 if (any (this_image(A) /= [2,3,8])) call abort()
51 if (this_image(A, dim=2) /= 4) call abort()
52 if (this_image(A, dim=3) /= 8) call abort()
54 if (this_image(A, dim=i) /= 4) call abort()
56 if (this_image(A, dim=i) /= 8) call abort()
57 if (any (this_image(A) /= [2,4,8])) call abort()
60 if (this_image(A, dim=2) /= 3) call abort()
61 if (this_image(A, dim=3) /= 9) call abort()
63 if (this_image(A, dim=i) /= 3) call abort()
65 if (this_image(A, dim=i) /= 9) call abort()
66 if (any (this_image(A) /= [2,3,9])) call abort()
69 if (this_image(A, dim=2) /= 4) call abort()
70 if (this_image(A, dim=3) /= 9) call abort()
72 if (this_image(A, dim=i) /= 4) call abort()
74 if (this_image(A, dim=i) /= 9) call abort()
75 if (any (this_image(A) /= [2,4,9])) call abort()
78 if (this_image(A, dim=2) /= 3) call abort()
79 if (this_image(A, dim=3) /= 10) call abort()
81 if (this_image(A, dim=i) /= 3) call abort()
83 if (this_image(A, dim=i) /= 10) call abort()
84 if (any (this_image(A) /= [2,3,10])) call abort()
87 if (this_image(A, dim=2) /= 4) call abort()
88 if (this_image(A, dim=3) /= 10) call abort()
90 if (this_image(A, dim=i) /= 4) call abort()
92 if (this_image(A, dim=i) /= 10) call abort()
93 if (any (this_image(A) /= [2,4,10])) call abort()
97 allocate (b(3)[-1:0,2:4,*])
99 select case (this_image())
101 if (this_image(B, dim=1) /= -1) call abort()
102 if (this_image(B, dim=2) /= 2) call abort()
103 if (this_image(B, dim=3) /= 1) call abort()
105 if (this_image(B, dim=i) /= -1) call abort()
107 if (this_image(B, dim=i) /= 2) call abort()
109 if (this_image(B, dim=i) /= 1) call abort()
110 if (any (this_image(B) /= [-1,2,1])) call abort()
113 if (this_image(B, dim=1) /= 0) call abort()
114 if (this_image(B, dim=2) /= 2) call abort()
115 if (this_image(B, dim=3) /= 1) call abort()
117 if (this_image(B, dim=i) /= 0) call abort()
119 if (this_image(B, dim=i) /= 2) call abort()
121 if (this_image(B, dim=i) /= 1) call abort()
122 if (any (this_image(B) /= [0,2,1])) call abort()
125 if (this_image(B, dim=1) /= -1) call abort()
126 if (this_image(B, dim=2) /= 3) call abort()
127 if (this_image(B, dim=3) /= 1) call abort()
129 if (this_image(B, dim=i) /= -1) call abort()
131 if (this_image(B, dim=i) /= 3) call abort()
133 if (this_image(B, dim=i) /= 1) call abort()
134 if (any (this_image(B) /= [-1,3,1])) call abort()
137 if (this_image(B, dim=1) /= 0) call abort()
138 if (this_image(B, dim=2) /= 3) call abort()
139 if (this_image(B, dim=3) /= 1) call abort()
141 if (this_image(B, dim=i) /= 0) call abort()
143 if (this_image(B, dim=i) /= 3) call abort()
145 if (this_image(B, dim=i) /= 1) call abort()
146 if (any (this_image(B) /= [0,3,1])) call abort()
149 if (this_image(B, dim=1) /= -1) call abort()
150 if (this_image(B, dim=2) /= 4) call abort()
151 if (this_image(B, dim=3) /= 1) call abort()
153 if (this_image(B, dim=i) /= -1) call abort()
155 if (this_image(B, dim=i) /= 4) call abort()
157 if (this_image(B, dim=i) /= 1) call abort()
158 if (any (this_image(B) /= [-1,4,1])) call abort()
161 if (this_image(B, dim=1) /= 0) call abort()
162 if (this_image(B, dim=2) /= 4) call abort()
163 if (this_image(B, dim=3) /= 1) call abort()
165 if (this_image(B, dim=i) /= 0) call abort()
167 if (this_image(B, dim=i) /= 4) call abort()
169 if (this_image(B, dim=i) /= 1) call abort()
170 if (any (this_image(B) /= [0,4,1])) call abort()
173 if (this_image(B, dim=1) /= -1) call abort()
174 if (this_image(B, dim=2) /= 2) call abort()
175 if (this_image(B, dim=3) /= 2) call abort()
177 if (this_image(B, dim=i) /= -1) call abort()
179 if (this_image(B, dim=i) /= 2) call abort()
181 if (this_image(B, dim=i) /= 2) call abort()
182 if (any (this_image(B) /= [-1,2,2])) call abort()
185 if (this_image(B, dim=1) /= 0) call abort()
186 if (this_image(B, dim=2) /= 2) call abort()
187 if (this_image(B, dim=3) /= 2) call abort()
189 if (this_image(B, dim=i) /= 0) call abort()
191 if (this_image(B, dim=i) /= 2) call abort()
193 if (this_image(B, dim=i) /= 2) call abort()
194 if (any (this_image(B) /= [0,2,2])) call abort()