From: peter klausler Date: Fri, 12 Apr 2019 17:20:42 +0000 (-0700) Subject: [flang] Finish up X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3484149aa7fa31e0cfc76e2e0043ab3fbd523db4;p=platform%2Fupstream%2Fllvm.git [flang] Finish up Original-commit: flang-compiler/f18@8c8242e6f441377ec2d209d5c178787d64f6398e Reviewed-on: https://github.com/flang-compiler/f18/pull/406 Tree-same-pre-rewrite: false --- diff --git a/flang/lib/semantics/resolve-names.cc b/flang/lib/semantics/resolve-names.cc index 27e7e89..aaf603e 100644 --- a/flang/lib/semantics/resolve-names.cc +++ b/flang/lib/semantics/resolve-names.cc @@ -2526,7 +2526,7 @@ void DeclarationVisitor::CheckScalarIntegerType(const parser::Name &name) { } 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; } } diff --git a/flang/test/semantics/CMakeLists.txt b/flang/test/semantics/CMakeLists.txt index ea6e7d1..a1bb925a 100644 --- a/flang/test/semantics/CMakeLists.txt +++ b/flang/test/semantics/CMakeLists.txt @@ -93,6 +93,7 @@ set(ERROR_TESTS nullify02.f90 deallocate01.f90 deallocate04.f90 + deallocate05.f90 ) # These test files have expected symbols in the source diff --git a/flang/test/semantics/deallocate04.f90 b/flang/test/semantics/deallocate04.f90 index 68649cf..a76ab6c 100644 --- a/flang/test/semantics/deallocate04.f90 +++ b/flang/test/semantics/deallocate04.f90 @@ -12,7 +12,7 @@ ! 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 @@ -23,7 +23,7 @@ Type t Type(dt) :: p End Type -Type(t),Allocatable :: x(:) +Type(t),Allocatable :: x Real :: r Integer :: s @@ -32,47 +32,13 @@ Integer :: pi 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 diff --git a/flang/test/semantics/deallocate05.f90 b/flang/test/semantics/deallocate05.f90 new file mode 100644 index 0000000..d3b64e3 --- /dev/null +++ b/flang/test/semantics/deallocate05.f90 @@ -0,0 +1,69 @@ +! 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 diff --git a/flang/test/semantics/doconcurrent04.f90 b/flang/test/semantics/doconcurrent04.f90 index f6b8fa7..ac03d94 100644 --- a/flang/test/semantics/doconcurrent04.f90 +++ b/flang/test/semantics/doconcurrent04.f90 @@ -13,10 +13,11 @@ ! 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