c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / select_rank_6.f90
blobd0121777bb5dd8ed09a79a04c6be531316b5c443
1 ! { dg-do compile }
2 ! PR fortran/100607 - fix diagnostics for SELECT RANK
3 ! Contributed by T.Burnus
5 program p
6 implicit none
7 integer, allocatable :: A(:,:,:)
9 allocate(a(5:6,-2:2, 99:100))
10 call foo(a)
11 call bar(a)
13 contains
15 subroutine foo(x)
16 integer, allocatable :: x(..)
17 if (rank(x) /= 3) stop 1
18 if (any (lbound(x) /= [5, -2, 99])) stop 2
20 select rank (x)
21 rank(3)
22 if (any (lbound(x) /= [5, -2, 99])) stop 3
23 end select
25 select rank (x) ! { dg-error "pointer or allocatable selector at .2." }
26 rank(*) ! { dg-error "pointer or allocatable selector at .2." }
27 if (rank(x) /= 1) stop 4
28 if (lbound(x, 1) /= 1) stop 5
29 end select
30 end
32 subroutine bar(x)
33 integer :: x(..)
34 if (rank(x) /= 3) stop 6
35 if (any (lbound(x) /= 1)) stop 7
37 select rank (x)
38 rank(3)
39 if (any (lbound(x) /= 1)) stop 8
40 end select
42 select rank (x)
43 rank(*)
44 if (rank(x) /= 1) stop 9
45 if (lbound(x, 1) /= 1) stop 10
46 end select
47 end
48 end