| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! PR fortran/18918 |
| 4 |
! |
| 5 |
! this_image(coarray) run test, |
| 6 |
! expecially for num_images > 1 |
| 7 |
! |
| 8 |
! Tested are values up to num_images == 8, |
| 9 |
! higher values are OK, but not tested for |
| 10 |
! |
| 11 |
implicit none |
| 12 |
integer :: a(1)[2:2, 3:4, 7:*] |
| 13 |
integer :: b(:)[:, :,:] |
| 14 |
allocatable :: b |
| 15 |
integer :: i |
| 16 |
|
| 17 |
if (this_image(A, dim=1) /= 2) STOP 1 |
| 18 |
i = 1 |
| 19 |
if (this_image(A, dim=i) /= 2) STOP 2 |
| 20 |
|
| 21 |
select case (this_image()) |
| 22 |
case (1) |
| 23 |
if (this_image(A, dim=2) /= 3) STOP 3 |
| 24 |
if (this_image(A, dim=3) /= 7) STOP 4 |
| 25 |
i = 2 |
| 26 |
if (this_image(A, dim=i) /= 3) STOP 5 |
| 27 |
i = 3 |
| 28 |
if (this_image(A, dim=i) /= 7) STOP 6 |
| 29 |
if (any (this_image(A) /= [2,3,7])) STOP 7 |
| 30 |
|
| 31 |
case (2) |
| 32 |
if (this_image(A, dim=2) /= 4) STOP 8 |
| 33 |
if (this_image(A, dim=3) /= 7) STOP 9 |
| 34 |
i = 2 |
| 35 |
if (this_image(A, dim=i) /= 4) STOP 10 |
| 36 |
i = 3 |
| 37 |
if (this_image(A, dim=i) /= 7) STOP 11 |
| 38 |
if (any (this_image(A) /= [2,4,7])) STOP 12 |
| 39 |
|
| 40 |
case (3) |
| 41 |
if (this_image(A, dim=2) /= 3) STOP 13 |
| 42 |
if (this_image(A, dim=3) /= 8) STOP 14 |
| 43 |
i = 2 |
| 44 |
if (this_image(A, dim=i) /= 3) STOP 15 |
| 45 |
i = 3 |
| 46 |
if (this_image(A, dim=i) /= 8) STOP 16 |
| 47 |
if (any (this_image(A) /= [2,3,8])) STOP 17 |
| 48 |
|
| 49 |
case (4) |
| 50 |
if (this_image(A, dim=2) /= 4) STOP 18 |
| 51 |
if (this_image(A, dim=3) /= 8) STOP 19 |
| 52 |
i = 2 |
| 53 |
if (this_image(A, dim=i) /= 4) STOP 20 |
| 54 |
i = 3 |
| 55 |
if (this_image(A, dim=i) /= 8) STOP 21 |
| 56 |
if (any (this_image(A) /= [2,4,8])) STOP 22 |
| 57 |
|
| 58 |
case (5) |
| 59 |
if (this_image(A, dim=2) /= 3) STOP 23 |
| 60 |
if (this_image(A, dim=3) /= 9) STOP 24 |
| 61 |
i = 2 |
| 62 |
if (this_image(A, dim=i) /= 3) STOP 25 |
| 63 |
i = 3 |
| 64 |
if (this_image(A, dim=i) /= 9) STOP 26 |
| 65 |
if (any (this_image(A) /= [2,3,9])) STOP 27 |
| 66 |
|
| 67 |
case (6) |
| 68 |
if (this_image(A, dim=2) /= 4) STOP 28 |
| 69 |
if (this_image(A, dim=3) /= 9) STOP 29 |
| 70 |
i = 2 |
| 71 |
if (this_image(A, dim=i) /= 4) STOP 30 |
| 72 |
i = 3 |
| 73 |
if (this_image(A, dim=i) /= 9) STOP 31 |
| 74 |
if (any (this_image(A) /= [2,4,9])) STOP 32 |
| 75 |
|
| 76 |
case (7) |
| 77 |
if (this_image(A, dim=2) /= 3) STOP 33 |
| 78 |
if (this_image(A, dim=3) /= 10) STOP 34 |
| 79 |
i = 2 |
| 80 |
if (this_image(A, dim=i) /= 3) STOP 35 |
| 81 |
i = 3 |
| 82 |
if (this_image(A, dim=i) /= 10) STOP 36 |
| 83 |
if (any (this_image(A) /= [2,3,10])) STOP 37 |
| 84 |
|
| 85 |
case (8) |
| 86 |
if (this_image(A, dim=2) /= 4) STOP 38 |
| 87 |
if (this_image(A, dim=3) /= 10) STOP 39 |
| 88 |
i = 2 |
| 89 |
if (this_image(A, dim=i) /= 4) STOP 40 |
| 90 |
i = 3 |
| 91 |
if (this_image(A, dim=i) /= 10) STOP 41 |
| 92 |
if (any (this_image(A) /= [2,4,10])) STOP 42 |
| 93 |
end select |
| 94 |
|
| 95 |
|
| 96 |
allocate (b(3)[-1:0,2:4,*]) |
| 97 |
|
| 98 |
select case (this_image()) |
| 99 |
case (1) |
| 100 |
if (this_image(B, dim=1) /= -1) STOP 43 |
| 101 |
if (this_image(B, dim=2) /= 2) STOP 44 |
| 102 |
if (this_image(B, dim=3) /= 1) STOP 45 |
| 103 |
i = 1 |
| 104 |
if (this_image(B, dim=i) /= -1) STOP 46 |
| 105 |
i = 2 |
| 106 |
if (this_image(B, dim=i) /= 2) STOP 47 |
| 107 |
i = 3 |
| 108 |
if (this_image(B, dim=i) /= 1) STOP 48 |
| 109 |
if (any (this_image(B) /= [-1,2,1])) STOP 49 |
| 110 |
|
| 111 |
case (2) |
| 112 |
if (this_image(B, dim=1) /= 0) STOP 50 |
| 113 |
if (this_image(B, dim=2) /= 2) STOP 51 |
| 114 |
if (this_image(B, dim=3) /= 1) STOP 52 |
| 115 |
i = 1 |
| 116 |
if (this_image(B, dim=i) /= 0) STOP 53 |
| 117 |
i = 2 |
| 118 |
if (this_image(B, dim=i) /= 2) STOP 54 |
| 119 |
i = 3 |
| 120 |
if (this_image(B, dim=i) /= 1) STOP 55 |
| 121 |
if (any (this_image(B) /= [0,2,1])) STOP 56 |
| 122 |
|
| 123 |
case (3) |
| 124 |
if (this_image(B, dim=1) /= -1) STOP 57 |
| 125 |
if (this_image(B, dim=2) /= 3) STOP 58 |
| 126 |
if (this_image(B, dim=3) /= 1) STOP 59 |
| 127 |
i = 1 |
| 128 |
if (this_image(B, dim=i) /= -1) STOP 60 |
| 129 |
i = 2 |
| 130 |
if (this_image(B, dim=i) /= 3) STOP 61 |
| 131 |
i = 3 |
| 132 |
if (this_image(B, dim=i) /= 1) STOP 62 |
| 133 |
if (any (this_image(B) /= [-1,3,1])) STOP 63 |
| 134 |
|
| 135 |
case (4) |
| 136 |
if (this_image(B, dim=1) /= 0) STOP 64 |
| 137 |
if (this_image(B, dim=2) /= 3) STOP 65 |
| 138 |
if (this_image(B, dim=3) /= 1) STOP 66 |
| 139 |
i = 1 |
| 140 |
if (this_image(B, dim=i) /= 0) STOP 67 |
| 141 |
i = 2 |
| 142 |
if (this_image(B, dim=i) /= 3) STOP 68 |
| 143 |
i = 3 |
| 144 |
if (this_image(B, dim=i) /= 1) STOP 69 |
| 145 |
if (any (this_image(B) /= [0,3,1])) STOP 70 |
| 146 |
|
| 147 |
case (5) |
| 148 |
if (this_image(B, dim=1) /= -1) STOP 71 |
| 149 |
if (this_image(B, dim=2) /= 4) STOP 72 |
| 150 |
if (this_image(B, dim=3) /= 1) STOP 73 |
| 151 |
i = 1 |
| 152 |
if (this_image(B, dim=i) /= -1) STOP 74 |
| 153 |
i = 2 |
| 154 |
if (this_image(B, dim=i) /= 4) STOP 75 |
| 155 |
i = 3 |
| 156 |
if (this_image(B, dim=i) /= 1) STOP 76 |
| 157 |
if (any (this_image(B) /= [-1,4,1])) STOP 77 |
| 158 |
|
| 159 |
case (6) |
| 160 |
if (this_image(B, dim=1) /= 0) STOP 78 |
| 161 |
if (this_image(B, dim=2) /= 4) STOP 79 |
| 162 |
if (this_image(B, dim=3) /= 1) STOP 80 |
| 163 |
i = 1 |
| 164 |
if (this_image(B, dim=i) /= 0) STOP 81 |
| 165 |
i = 2 |
| 166 |
if (this_image(B, dim=i) /= 4) STOP 82 |
| 167 |
i = 3 |
| 168 |
if (this_image(B, dim=i) /= 1) STOP 83 |
| 169 |
if (any (this_image(B) /= [0,4,1])) STOP 84 |
| 170 |
|
| 171 |
case (7) |
| 172 |
if (this_image(B, dim=1) /= -1) STOP 85 |
| 173 |
if (this_image(B, dim=2) /= 2) STOP 86 |
| 174 |
if (this_image(B, dim=3) /= 2) STOP 87 |
| 175 |
i = 1 |
| 176 |
if (this_image(B, dim=i) /= -1) STOP 88 |
| 177 |
i = 2 |
| 178 |
if (this_image(B, dim=i) /= 2) STOP 89 |
| 179 |
i = 3 |
| 180 |
if (this_image(B, dim=i) /= 2) STOP 90 |
| 181 |
if (any (this_image(B) /= [-1,2,2])) STOP 91 |
| 182 |
|
| 183 |
case (8) |
| 184 |
if (this_image(B, dim=1) /= 0) STOP 92 |
| 185 |
if (this_image(B, dim=2) /= 2) STOP 93 |
| 186 |
if (this_image(B, dim=3) /= 2) STOP 94 |
| 187 |
i = 1 |
| 188 |
if (this_image(B, dim=i) /= 0) STOP 95 |
| 189 |
i = 2 |
| 190 |
if (this_image(B, dim=i) /= 2) STOP 96 |
| 191 |
i = 3 |
| 192 |
if (this_image(B, dim=i) /= 2) STOP 97 |
| 193 |
if (any (this_image(B) /= [0,2,2])) STOP 98 |
| 194 |
end select |
| 195 |
|
| 196 |
end |