Debian Codegraph @

gcc/testsuite/gfortran.dg/implied_shape_4.f90

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-std=f2008" }
3 !
4 ! PR fortran/68020
5 !
6 ! Contributed by Gerhard Steinmetz
7 !
8 subroutine rank_1_2
9 integer, parameter :: a(1, 2) = 0
10 integer, parameter :: x(*, *) = a
11 integer, parameter :: y(11:*, 12:*) = a
12 integer :: k
13 if (any (lbound(x) /= [1,1])) stop 1
14 if (any (ubound(x) /= [1,2])) stop 2
15 if (any (lbound(y) /= [11,12])) stop 3
16 if (any (ubound(y) /= [11,13])) stop 4
17 end
18
19 subroutine rank_3
20 integer, parameter :: a(1, 2, 3) = 0
21 integer, parameter :: x(*, *, *) = a
22 integer, parameter :: y(11:*, 12:*, 13:*) = a
23 integer :: k
24 if (any (lbound(x) /= [1,1,1])) stop 5
25 if (any (ubound(x) /= [1,2,3])) stop 6
26 if (any (lbound(y) /= [11,12,13])) stop 7
27 if (any (ubound(y) /= [11,13,15])) stop 8
28 end
29
30 subroutine rank_4
31 integer, parameter :: a(1, 2, 3, 4) = 0
32 integer, parameter :: x(*, *, *, *) = a
33 integer, parameter :: y(11:*, 12:*, 13:*, 14:*) = a
34 integer :: k
35 if (any (lbound(x) /= [1,1,1,1])) stop 9
36 if (any (ubound(x) /= [1,2,3,4])) stop 10
37 if (any (lbound(y) /= [11,12,13,14])) stop 11
38 if (any (ubound(y) /= [11,13,15,17])) stop 12
39 end
40
41 program p
42 call rank_1_2
43 call rank_3
44 call rank_4
45 end program p