Debian Codegraph @

gcc/testsuite/gfortran.dg/coarray/codimension_3.f90

raw
1 ! { dg-do run }
2 !
3 ! PR fortran/84135
4 !
5 ! Co-contributed by G. Steinmetz
6 !
7 ! Ensure that coarray shape remains correct
8 ! after merging the shape from 'dimension'
9 !
10 program p
11 integer :: i
12 integer, dimension(3) :: x[2,*]
13 data (x(i:i+2:i+1), i=1,2) /1,2,3/
14 integer, dimension(3) :: y[2,3,-3:4,5,7:*] = [1,2,3]
15 integer :: z, z2[2:4,7:9,-2:2,-7:8,-4:*]
16 codimension :: z[2:4,7:9,-2:2,-7:8,-4:*]
17 integer, codimension[1:*] :: z3[2:4,7:9,-2:2,-7:8,-4:*]
18 dimension :: z(1:2,-3:-2,7:7), z2(1:2,-3:-2,7:7), z3(1:2,-3:-2,7:7)
19 integer, codimension[2:4,7:9,-2:2,-7:8,-4:*], dimension(1:2,-3:-2,7:7) :: z4
20 integer, codimension[*], dimension(1:2,-3:-2,7:7) :: z5[2:4,7:9,-2:2,-7:8,-4:*]
21 integer, codimension[2:4,7:9,-2:2,-7:8,-4:*], dimension(3) :: z6(1:2,-3:-2,7:7)
22 integer, codimension[*], dimension(4) :: z7(1:2,-3:-2,7:7)[2:4,7:9,-2:2,-7:8,-4:*]
23
24 if (any (lcobound(x) /= [1, 1])) stop 1
25 if (any (lcobound(y) /= [1, 1, -3, 1, 7])) stop 3
26 if (any (lcobound(z) /= [2,7,-2,-7,-4])) stop 4
27 if (any (lcobound(z2) /= lcobound(z))) stop 4
28 if (any (lcobound(z3) /= lcobound(z))) stop 5
29 if (any (lcobound(z4) /= lcobound(z))) stop 6
30 if (any (lcobound(z5) /= lcobound(z))) stop 7
31 if (any (lcobound(z6) /= lcobound(z))) stop 8
32 if (any (lcobound(z7) /= lcobound(z))) stop 9
33
34 if (any (lbound(x) /= [1])) stop 11
35 if (any (lbound(y) /= [1])) stop 12
36 if (any (lbound(z) /= [1,-3,7])) stop 13
37 if (any (lbound(z2) /= lbound(z))) stop 14
38 if (any (lbound(z3) /= lbound(z))) stop 15
39 if (any (lbound(z4) /= lbound(z))) stop 16
40 if (any (lbound(z5) /= lbound(z))) stop 17
41 if (any (lbound(z6) /= lbound(z))) stop 18
42 if (any (lbound(z7) /= lbound(z))) stop 19
43
44 if (any (ubound(x) /= [3])) stop 21
45 if (any (ubound(y) /= [3])) stop 22
46 if (any (ubound(z) /= [2,-2,7])) stop 23
47 if (any (ubound(z2) /= ubound(z))) stop 24
48 if (any (ubound(z3) /= ubound(z))) stop 25
49 if (any (ubound(z4) /= ubound(z))) stop 26
50 if (any (ubound(z5) /= ubound(z))) stop 27
51 if (any (ubound(z6) /= ubound(z))) stop 28
52 if (any (ubound(z7) /= ubound(z))) stop 29
53
54 if (any (ucobound(z2) /= ucobound(z))) stop 31
55 if (any (ucobound(z3) /= ucobound(z))) stop 32
56 if (any (ucobound(z4) /= ucobound(z))) stop 33
57 if (any (ucobound(z5) /= ucobound(z))) stop 34
58 if (any (ucobound(z6) /= ucobound(z))) stop 35
59 if (any (ucobound(z7) /= ucobound(z))) stop 36
60
61 if (num_images() == 1) then
62 if (any (ucobound(x) /= [2, lbound(x,dim=1)])) stop 37
63 if (any (ucobound(y) /= [2, 3, 4, 5, 7])) stop 38
64 if (any (ucobound(z) /= [4,9,2,8,-4])) stop 39
65 else
66 if (ucobound(x, dim=1) /= 2) stop 41
67 if (ucobound(y, dim=1) /= 2) stop 42
68 if (ucobound(y, dim=2) /= 3) stop 43
69 if (ucobound(y, dim=3) /= 4) stop 44
70 if (ucobound(y, dim=4) /= 5) stop 45
71 if (ucobound(z, dim=1) /= 4) stop 46
72 if (ucobound(z, dim=2) /= 9) stop 47
73 if (ucobound(z, dim=3) /= 2) stop 48
74 if (ucobound(z, dim=4) /= 8) stop 49
75 endif
76 end