}
if (auto *type{symbol.GetType()}) {
if (!type->IsNumeric(TypeCategory::Integer)) {
- Say(name, "Variable '%s' is not integer"_err_en_US);
+ Say(name, "Variable '%s' is not INTEGER"_err_en_US);
return;
}
}
nullify02.f90
deallocate01.f90
deallocate04.f90
+ deallocate05.f90
)
# These test files have expected symbols in the source
! See the License for the specific language governing permissions and
! limitations under the License.
-! Check for semantic errors in DEALLOCATE statements
+! Check for type errors in DEALLOCATE statements
INTEGER, PARAMETER :: maxvalue=1024
Type(dt) :: p
End Type
-Type(t),Allocatable :: x(:)
+Type(t),Allocatable :: x
Real :: r
Integer :: s
Character(256) :: ee
Procedure(Real) :: prp
-Allocate(x(3))
+Allocate(x)
-!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
-Deallocate(x(2)%p)
+!ERROR: Must have CHARACTER type, but is INTEGER(4)
+Deallocate(x, stat=s, errmsg=e)
-!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
-Deallocate(pi)
-
-!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
-!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
-Deallocate(x(2)%p, pi)
-
-!ERROR: name in DEALLOCATE statement must be a variable name
-Deallocate(prp)
-
-!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
-!ERROR: name in DEALLOCATE statement must be a variable name
-Deallocate(pi, prp)
-
-!ERROR: name in DEALLOCATE statement must be a variable name
-Deallocate(maxvalue)
-
-!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
-Deallocate(x%p)
-
-!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
-!ERROR: Must have default CHARACTER type
-Deallocate(x%p, stat=s, errmsg=e)
-
-!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
-!ERROR: Must have INTEGER type
-!ERROR: Must have default CHARACTER type
-Deallocate(x%p, stat=r, errmsg=e)
-
-!ERROR: STAT may not be duplicated in a DEALLOCATE statement
-Deallocate(x, stat=s, stat=s)
-!ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement
-Deallocate(x, errmsg=ee, errmsg=ee)
-!ERROR: STAT may not be duplicated in a DEALLOCATE statement
-Deallocate(x, stat=s, errmsg=ee, stat=s)
-!ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement
-Deallocate(x, stat=s, errmsg=ee, errmsg=ee)
+!ERROR: Must have INTEGER type, but is REAL(4)
+!ERROR: Must have CHARACTER type, but is INTEGER(4)
+Deallocate(x, stat=r, errmsg=e)
End Program
--- /dev/null
+! Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
+!
+! Licensed under the Apache License, Version 2.0 (the "License");
+! you may not use this file except in compliance with the License.
+! You may obtain a copy of the License at
+!
+! http://www.apache.org/licenses/LICENSE-2.0
+!
+! Unless required by applicable law or agreed to in writing, software
+! distributed under the License is distributed on an "AS IS" BASIS,
+! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+! See the License for the specific language governing permissions and
+! limitations under the License.
+
+! Check for semantic errors in DEALLOCATE statements
+
+INTEGER, PARAMETER :: maxvalue=1024
+
+Type dt
+ Integer :: l = 3
+End Type
+Type t
+ Type(dt) :: p
+End Type
+
+Type(t),Allocatable :: x(:)
+
+Real :: r
+Integer :: s
+Integer :: e
+Integer :: pi
+Character(256) :: ee
+Procedure(Real) :: prp
+
+Allocate(x(3))
+
+!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
+Deallocate(x(2)%p)
+
+!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
+Deallocate(pi)
+
+!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
+!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
+Deallocate(x(2)%p, pi)
+
+!ERROR: name in DEALLOCATE statement must be a variable name
+Deallocate(prp)
+
+!ERROR: name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
+!ERROR: name in DEALLOCATE statement must be a variable name
+Deallocate(pi, prp)
+
+!ERROR: name in DEALLOCATE statement must be a variable name
+Deallocate(maxvalue)
+
+!ERROR: component in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute
+Deallocate(x%p)
+
+!ERROR: STAT may not be duplicated in a DEALLOCATE statement
+Deallocate(x, stat=s, stat=s)
+!ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement
+Deallocate(x, errmsg=ee, errmsg=ee)
+!ERROR: STAT may not be duplicated in a DEALLOCATE statement
+Deallocate(x, stat=s, errmsg=ee, stat=s)
+!ERROR: ERRMSG may not be duplicated in a DEALLOCATE statement
+Deallocate(x, stat=s, errmsg=ee, errmsg=ee)
+
+End Program
! limitations under the License.
! RUN: ${F18} -funparse-with-symbols %s 2>&1 | ${FileCheck} %s
-! CHECK: must have INTEGER type, but is REAL(4)
+! CHECK: Variable 'j' is not INTEGER
-subroutine do_concurrent_test1(i,n)
+subroutine do_concurrent_test1(n)
implicit none
+ integer :: n
real :: j
do 20 concurrent (j = 1:n)
20 enddo