OSDN Git Service

Merge tree-ssa-20020619-branch into mainline.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.fortran-torture / execute / bounds.f90
1 ! Program to test the upper and lower bound intrinsics
2 program testbounds
3    implicit none
4    real, dimension(:, :), allocatable :: a
5    integer, dimension(5) :: j
6    integer i
7
8    allocate (a(3:8, 6:7))
9
10    ! With one parameter
11    j = 0;
12    j(3:4) = ubound(a)
13    if (j(3) .ne. 8) call abort
14    if (j(4) .ne. 7) call abort
15
16    ! With two parameters, assigning to an array
17    j = lbound(a, 1)
18    if ((j(1) .ne. 3) .or. (j(5) .ne. 3)) call abort
19
20    ! With a variable second parameter
21    i = 2
22    i = lbound(a, i)
23    if (i .ne. 6) call abort
24
25    call test(a)
26 contains
27 subroutine test (a)
28    real, dimension (1:, 1:) :: a
29    integer i
30
31    i = 2
32    if ((ubound(a, 1) .ne. 6) .or. (ubound(a, i) .ne. 2)) call abort
33 end subroutine
34 end program
35