From c74f40f46ea7328b6c6349d96829f9c607982b75 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Wed, 4 Sep 2019 15:21:20 -0700 Subject: [PATCH] [flang] call07.f90 Original-commit: flang-compiler/f18@a92307c3d6dba7221b2446b4e54e79212591845e Reviewed-on: https://github.com/flang-compiler/f18/pull/711 Tree-same-pre-rewrite: false --- flang/test/semantics/call07.f90 | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 flang/test/semantics/call07.f90 diff --git a/flang/test/semantics/call07.f90 b/flang/test/semantics/call07.f90 new file mode 100644 index 0000000..b93e8ed --- /dev/null +++ b/flang/test/semantics/call07.f90 @@ -0,0 +1,54 @@ +! 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. + +! Test 15.5.2.7 constraints and restrictions for POINTER dummy arguments. + +module m + contains + + subroutine s01(p) + real, pointer, contiguous, intent(in) :: p(:) + end subroutine + subroutine s02(p) + real, pointer :: p(:) + end subroutine + subroutine s03(p) + real, pointer, intent(in) :: p(:) + end subroutine + + subroutine test + ! ERROR: CONTIGUOUS pointer must be an array + real, pointer, contiguous :: a01 ! C830 + real, pointer :: a02 + real, target :: a03(10) + real :: a04(10) ! not TARGET + call s01(a03) ! ok + ! ERROR: Effective argument associated with CONTIGUOUS POINTER dummy argument must be simply contiguous + call s01(a02) + ! ERROR: Effective argument associated with CONTIGUOUS POINTER dummy argument must be simply contiguous + call s01(a03(::2)) + ! ERROR: Effective argument associated with CONTIGUOUS POINTER dummy argument must be simply contiguous + call s01(a03([1,2,4])) + call s02(a02) ! ok + call s03(a03) ! ok + ! ERROR: Effective argument associated with POINTER dummy argument must be POINTER unless INTENT(IN) + call s02(a03) + ! ERROR: Effective argument associated with POINTER INTENT(IN) dummy argument must be a valid target if not a POINTER + call s03(a03([1,2,4])) + ! ERROR: Effective argument associated with POINTER INTENT(IN) dummy argument must be a valid target if not a POINTER + call s03([1.]) + ! ERROR: Effective argument associated with POINTER INTENT(IN) dummy argument must be a valid target if not a POINTER + call s03(a04) + end subroutine +end module -- 2.7.4