[flang-commits] [flang] [flang] Allow assumed-shape element pass to dummy arg with ignore_tkr (PR #78196)
via flang-commits
flang-commits at lists.llvm.org
Mon Jan 15 09:57:33 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-semantics
Author: Tom Eccles (tblah)
<details>
<summary>Changes</summary>
This is allowed by gfortran and ifort with `![GCC|DEC]$ ATTRIBUTES NO_ARG_CHECK`
---
Full diff: https://github.com/llvm/llvm-project/pull/78196.diff
2 Files Affected:
- (modified) flang/lib/Semantics/check-call.cpp (+2-1)
- (added) flang/test/Semantics/ignore_tkr03.f90 (+18)
``````````diff
diff --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp
index ec8f99ca6bf48e..ba8903089f836d 100644
--- a/flang/lib/Semantics/check-call.cpp
+++ b/flang/lib/Semantics/check-call.cpp
@@ -535,7 +535,8 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
messages.Say(
"Element of pointer array may not be associated with a %s array"_err_en_US,
dummyName);
- } else if (IsAssumedShape(*actualLastSymbol)) {
+ } else if (IsAssumedShape(*actualLastSymbol) &&
+ !dummy.ignoreTKR.test(common::IgnoreTKR::Rank)) {
basicError = true;
messages.Say(
"Element of assumed-shape array may not be associated with a %s array"_err_en_US,
diff --git a/flang/test/Semantics/ignore_tkr03.f90 b/flang/test/Semantics/ignore_tkr03.f90
new file mode 100644
index 00000000000000..25182d879e1097
--- /dev/null
+++ b/flang/test/Semantics/ignore_tkr03.f90
@@ -0,0 +1,18 @@
+! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
+module library
+contains
+ subroutine lib_sub(buf)
+!dir$ ignore_tkr(r) buf
+ real :: buf(1:*)
+ end subroutine
+end module
+
+module user
+ use library
+contains
+ subroutine sub(var)
+ real :: var(:,:,:)
+! CHECK: CALL lib_sub
+ call lib_sub(var(1, 2, 3))
+ end subroutine
+end module
``````````
</details>
https://github.com/llvm/llvm-project/pull/78196
More information about the flang-commits
mailing list