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/] [allocate.f90] - Rev 378

Go to most recent revision | Compare with Previous | Blame | View Log

! Test allocation and deallocation.
program test_allocate
  call t1 (.true.)
  call t1 (.false.)
  call t2
contains

! Implicit deallocation and saved aloocated variables.
subroutine t1(first)
  real, allocatable, save :: p(:)
  real, allocatable :: q(:)
  logical first

  if (first) then
    if (allocated (p)) call abort ()
  else
    if (.not. allocated (p)) call abort ()
  end if
  if (allocated (q)) call abort ()

  if (first) then
    allocate (p(5))
  else
    deallocate (p)
  end if
  allocate (q(5))
end subroutine

! Explicit deallocation.
subroutine t2()
  real, allocatable :: r(:)

  allocate (r(5))
  pr = 1.0
  deallocate (r)
  if (allocated(r)) call abort ()
end subroutine
end program

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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