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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [bounds.f90] - Diff between revs 154 and 816

Only display areas with differences | Details | Blame | View Log

Rev 154 Rev 816
! Program to test the upper and lower bound intrinsics
! Program to test the upper and lower bound intrinsics
program testbounds
program testbounds
   implicit none
   implicit none
   real, dimension(:, :), allocatable :: a
   real, dimension(:, :), allocatable :: a
   integer, dimension(5) :: j
   integer, dimension(5) :: j
   integer i
   integer i
   ! Check compile time simplification
   ! Check compile time simplification
   if (lbound(j,1).ne.1 .or. ubound(j,1).ne.5) call abort ()
   if (lbound(j,1).ne.1 .or. ubound(j,1).ne.5) call abort ()
   allocate (a(3:8, 6:7))
   allocate (a(3:8, 6:7))
   ! With one parameter
   ! With one parameter
   j = 0;
   j = 0;
   j(3:4) = ubound(a)
   j(3:4) = ubound(a)
   if (j(3) .ne. 8) call abort
   if (j(3) .ne. 8) call abort
   if (j(4) .ne. 7) call abort
   if (j(4) .ne. 7) call abort
   ! With two parameters, assigning to an array
   ! With two parameters, assigning to an array
   j = lbound(a, 1)
   j = lbound(a, 1)
   if ((j(1) .ne. 3) .or. (j(5) .ne. 3)) call abort
   if ((j(1) .ne. 3) .or. (j(5) .ne. 3)) call abort
   ! With a variable second parameter
   ! With a variable second parameter
   i = 2
   i = 2
   i = lbound(a, i)
   i = lbound(a, i)
   if (i .ne. 6) call abort
   if (i .ne. 6) call abort
   call test(a)
   call test(a)
contains
contains
subroutine test (a)
subroutine test (a)
   real, dimension (1:, 1:) :: a
   real, dimension (1:, 1:) :: a
   integer i
   integer i
   i = 2
   i = 2
   if ((ubound(a, 1) .ne. 6) .or. (ubound(a, i) .ne. 2)) call abort
   if ((ubound(a, 1) .ne. 6) .or. (ubound(a, i) .ne. 2)) call abort
end subroutine
end subroutine
end program
end program
 
 

powered by: WebSVN 2.1.0

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