OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [allocate.f90] - Diff between revs 303 and 384

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

Rev 303 Rev 384
! Test allocation and deallocation.
! Test allocation and deallocation.
program test_allocate
program test_allocate
  call t1 (.true.)
  call t1 (.true.)
  call t1 (.false.)
  call t1 (.false.)
  call t2
  call t2
contains
contains
! Implicit deallocation and saved aloocated variables.
! Implicit deallocation and saved aloocated variables.
subroutine t1(first)
subroutine t1(first)
  real, allocatable, save :: p(:)
  real, allocatable, save :: p(:)
  real, allocatable :: q(:)
  real, allocatable :: q(:)
  logical first
  logical first
  if (first) then
  if (first) then
    if (allocated (p)) call abort ()
    if (allocated (p)) call abort ()
  else
  else
    if (.not. allocated (p)) call abort ()
    if (.not. allocated (p)) call abort ()
  end if
  end if
  if (allocated (q)) call abort ()
  if (allocated (q)) call abort ()
  if (first) then
  if (first) then
    allocate (p(5))
    allocate (p(5))
  else
  else
    deallocate (p)
    deallocate (p)
  end if
  end if
  allocate (q(5))
  allocate (q(5))
end subroutine
end subroutine
! Explicit deallocation.
! Explicit deallocation.
subroutine t2()
subroutine t2()
  real, allocatable :: r(:)
  real, allocatable :: r(:)
  allocate (r(5))
  allocate (r(5))
  pr = 1.0
  pr = 1.0
  deallocate (r)
  deallocate (r)
  if (allocated(r)) call abort ()
  if (allocated(r)) 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.