79 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Check for semantic errors in DEALLOCATE statements3 4Module share5 Real, Pointer :: rp6End Module share7 8Program deallocatetest9Use share10 11INTEGER, PARAMETER :: maxvalue=102412 13Type dt14 Integer :: l = 315End Type16Type t17 Type(dt) :: p18End Type19 20Type(t),Allocatable :: x(:)21 22Real :: r23Integer :: s24Integer, Parameter :: const_s = 1325Integer :: e26Integer :: pi27Character(256) :: ee28Procedure(Real) :: prp29 30type at31 real, allocatable :: a32end type33type(at) :: c[*]34 35Allocate(rp)36Deallocate(rp)37 38Allocate(x(3))39 40!ERROR: Component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute41Deallocate(x(2)%p)42 43!ERROR: Name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute44Deallocate(pi)45 46!ERROR: Component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute47!ERROR: Name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute48Deallocate(x(2)%p, pi)49 50!ERROR: Name in DEALLOCATE statement must be a variable name51Deallocate(prp)52 53!ERROR: Name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute54!ERROR: Name in DEALLOCATE statement must be a variable name55Deallocate(pi, prp)56 57!ERROR: Name in DEALLOCATE statement must be a variable name58Deallocate(maxvalue)59 60!ERROR: Component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute61Deallocate(x%p)62 63!ERROR: STAT may not be duplicated in a DEALLOCATE statement64Deallocate(x, stat=s, stat=s)65!ERROR: STAT variable 'const_s' is not definable66!BECAUSE: '13_4' is not a variable or pointer67Deallocate(x, stat=const_s)68!ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement69Deallocate(x, errmsg=ee, errmsg=ee)70!ERROR: STAT may not be duplicated in a DEALLOCATE statement71Deallocate(x, stat=s, errmsg=ee, stat=s)72!ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement73Deallocate(x, stat=s, errmsg=ee, errmsg=ee)74 75!ERROR: Component in DEALLOCATE statement may not be coindexed76deallocate(c[1]%a)77 78End Program deallocatetest79