aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_size.f90
blob: 729c55f228304c9c568aea3be1dcabb62d91bf02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
! Program to test the SIZE intrinsics
program testsize
   implicit none
   real, dimension(:, :), allocatable :: a
   integer, dimension(5) :: j
   integer, dimension(2, 3) :: b
   integer i

   if (size (b(2, :), 1) .ne. 3) call abort
   
   allocate (a(3:8, 5:7))

   ! With one parameter
   if (size(a) .ne. 18) call abort

   ! With two parameters, assigning to an array
   j = size(a, 1)
   if (any (j .ne. (/6, 6, 6, 6, 6/))) call abort

   ! With a variable second parameter
   i = 2
   i = size(a, i)
   if (i .ne. 3) call abort

   call test(a)
contains

subroutine test (a)
   real, dimension (1:, 1:) :: a
   integer i

   i = 2
   if ((size(a, 1) .ne. 6) .or. (size(a, i) .ne. 3)) call abort
   if (size (a) .ne. 18 ) call abort
end subroutine
end program