OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [bounds.f90] - Blame information for rev 303

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 303 jeremybenn
! 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
   ! Check compile time simplification
9
   if (lbound(j,1).ne.1 .or. ubound(j,1).ne.5) call abort ()
10
 
11
   allocate (a(3:8, 6:7))
12
 
13
   ! With one parameter
14
   j = 0;
15
   j(3:4) = ubound(a)
16
   if (j(3) .ne. 8) call abort
17
   if (j(4) .ne. 7) call abort
18
 
19
   ! With two parameters, assigning to an array
20
   j = lbound(a, 1)
21
   if ((j(1) .ne. 3) .or. (j(5) .ne. 3)) call abort
22
 
23
   ! With a variable second parameter
24
   i = 2
25
   i = lbound(a, i)
26
   if (i .ne. 6) call abort
27
 
28
   call test(a)
29
contains
30
subroutine test (a)
31
   real, dimension (1:, 1:) :: a
32
   integer i
33
 
34
   i = 2
35
   if ((ubound(a, 1) .ne. 6) .or. (ubound(a, i) .ne. 2)) call abort
36
end subroutine
37
end program
38
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.