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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [allocate.f90] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
! Test allocation and deallocation.
2
program test_allocate
3
  call t1 (.true.)
4
  call t1 (.false.)
5
  call t2
6
contains
7
 
8
! Implicit deallocation and saved aloocated variables.
9
subroutine t1(first)
10
  real, allocatable, save :: p(:)
11
  real, allocatable :: q(:)
12
  logical first
13
 
14
  if (first) then
15
    if (allocated (p)) call abort ()
16
  else
17
    if (.not. allocated (p)) call abort ()
18
  end if
19
  if (allocated (q)) call abort ()
20
 
21
  if (first) then
22
    allocate (p(5))
23
  else
24
    deallocate (p)
25
  end if
26
  allocate (q(5))
27
end subroutine
28
 
29
! Explicit deallocation.
30
subroutine t2()
31
  real, allocatable :: r(:)
32
 
33
  allocate (r(5))
34
  pr = 1.0
35
  deallocate (r)
36
  if (allocated(r)) call abort ()
37
end subroutine
38
end program

powered by: WebSVN 2.1.0

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