1! RUN: %S/test_errors.sh %s %t %flang_fc1
2! REQUIRES: shell
3! Test that DEALLOCATE works
4
5INTEGER, PARAMETER :: maxvalue=1024
6
7Type dt
8  Integer :: l = 3
9End Type
10Type t
11  Type(dt),Pointer :: p
12End Type
13
14Type(t),Allocatable :: x(:)
15Type(t),Pointer :: y(:)
16Type(t),Pointer :: z
17Integer :: s
18CHARACTER(256) :: e
19
20Integer, Pointer :: pi
21
22Allocate(pi)
23Allocate(x(3))
24
25Deallocate(x(2)%p)
26
27Deallocate(y(2)%p)
28
29Deallocate(pi)
30
31Deallocate(z%p)
32
33Deallocate(x%p, stat=s, errmsg=e)
34Deallocate(x%p, errmsg=e)
35Deallocate(x%p, stat=s)
36
37Deallocate(y%p, stat=s, errmsg=e)
38Deallocate(y%p, errmsg=e)
39Deallocate(y%p, stat=s)
40
41Deallocate(z, stat=s, errmsg=e)
42Deallocate(z, errmsg=e)
43Deallocate(z, stat=s)
44
45Deallocate(z, y%p, stat=s, errmsg=e)
46Deallocate(z, y%p, errmsg=e)
47Deallocate(z, y%p, stat=s)
48
49End Program
50