Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gfortran.fortran-torture / execute / allocate.f90
blob61f717da7bc9dd7ee609d6c526c564db843c2020
1 ! Test allocation and deallocation.
2 program test_allocate
3 call t1 (.true.)
4 call t1 (.false.)
5 call t2
6 contains
8 ! Implicit deallocation and saved aloocated variables.
9 subroutine t1(first)
10 real, allocatable, save :: p(:)
11 real, allocatable :: q(:)
12 logical first
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 ()
21 if (first) then
22 allocate (p(5))
23 else
24 deallocate (p)
25 end if
26 allocate (q(5))
27 end subroutine
29 ! Explicit deallocation.
30 subroutine t2()
31 real, allocatable :: r(:)
33 allocate (r(5))
34 pr = 1.0
35 deallocate (r)
36 if (allocated(r)) call abort ()
37 end subroutine
38 end program