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