[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / deallocate05.f90
blobe065f07ab689a5e256f7a5a5ad9077397f81d095
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 ! Check for semantic errors in DEALLOCATE statements
5 Module share
6 Real, Pointer :: rp
7 End Module share
9 Program deallocatetest
10 Use share
12 INTEGER, PARAMETER :: maxvalue=1024
14 Type dt
15 Integer :: l = 3
16 End Type
17 Type t
18 Type(dt) :: p
19 End Type
21 Type(t),Allocatable :: x(:)
23 Real :: r
24 Integer :: s
25 Integer, Parameter :: const_s = 13
26 Integer :: e
27 Integer :: pi
28 Character(256) :: ee
29 Procedure(Real) :: prp
31 Allocate(rp)
32 Deallocate(rp)
34 Allocate(x(3))
36 !ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
37 Deallocate(x(2)%p)
39 !ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
40 Deallocate(pi)
42 !ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
43 !ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
44 Deallocate(x(2)%p, pi)
46 !ERROR: name in DEALLOCATE statement must be a variable name
47 Deallocate(prp)
49 !ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
50 !ERROR: name in DEALLOCATE statement must be a variable name
51 Deallocate(pi, prp)
53 !ERROR: name in DEALLOCATE statement must be a variable name
54 Deallocate(maxvalue)
56 !ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
57 Deallocate(x%p)
59 !ERROR: STAT may not be duplicated in a DEALLOCATE statement
60 Deallocate(x, stat=s, stat=s)
61 !ERROR: STAT variable 'const_s' must be definable
62 Deallocate(x, stat=const_s)
63 !ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement
64 Deallocate(x, errmsg=ee, errmsg=ee)
65 !ERROR: STAT may not be duplicated in a DEALLOCATE statement
66 Deallocate(x, stat=s, errmsg=ee, stat=s)
67 !ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement
68 Deallocate(x, stat=s, errmsg=ee, errmsg=ee)
70 End Program deallocatetest