1! RUN: %S/test_errors.sh %s %t %f18
2! Check for semantic errors in DEALLOCATE statements
3
4Module share
5  Real, Pointer :: rp
6End Module share
7
8Program deallocatetest
9Use share
10
11INTEGER, PARAMETER :: maxvalue=1024
12
13Type dt
14  Integer :: l = 3
15End Type
16Type t
17  Type(dt) :: p
18End Type
19
20Type(t),Allocatable :: x(:)
21
22Real :: r
23Integer :: s
24Integer :: e
25Integer :: pi
26Character(256) :: ee
27Procedure(Real) :: prp
28
29Allocate(rp)
30Deallocate(rp)
31
32Allocate(x(3))
33
34!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
35Deallocate(x(2)%p)
36
37!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
38Deallocate(pi)
39
40!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
41!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
42Deallocate(x(2)%p, pi)
43
44!ERROR: name in DEALLOCATE statement must be a variable name
45Deallocate(prp)
46
47!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
48!ERROR: name in DEALLOCATE statement must be a variable name
49Deallocate(pi, prp)
50
51!ERROR: name in DEALLOCATE statement must be a variable name
52Deallocate(maxvalue)
53
54!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
55Deallocate(x%p)
56
57!ERROR: STAT may not be duplicated in a DEALLOCATE statement
58Deallocate(x, stat=s, stat=s)
59!ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement
60Deallocate(x, errmsg=ee, errmsg=ee)
61!ERROR: STAT may not be duplicated in a DEALLOCATE statement
62Deallocate(x, stat=s, errmsg=ee, stat=s)
63!ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement
64Deallocate(x, stat=s, errmsg=ee, errmsg=ee)
65
66End Program deallocatetest
67