[flang-commits] [flang] 37f94cd - [flang] Accept KIND(x) when x is assumed-rank (#107787)
via flang-commits
flang-commits at lists.llvm.org
Tue Sep 10 14:14:37 PDT 2024
Author: Peter Klausler
Date: 2024-09-10T14:14:33-07:00
New Revision: 37f94cd99a5bc4b186651d6967d8595c4786d8ed
URL: https://github.com/llvm/llvm-project/commit/37f94cd99a5bc4b186651d6967d8595c4786d8ed
DIFF: https://github.com/llvm/llvm-project/commit/37f94cd99a5bc4b186651d6967d8595c4786d8ed.diff
LOG: [flang] Accept KIND(x) when x is assumed-rank (#107787)
Don't emit a bogus error about being unable to forward an assumed-rank
dummy argument as an actual argument in the case of the KIND intrinsic
function.
Fixes https://github.com/llvm/llvm-project/issues/107782.
Added:
flang/test/Evaluate/fold-assumed-rank-kind.f90
Modified:
flang/lib/Evaluate/intrinsics.cpp
Removed:
################################################################################
diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index ebe946ac60ccb1..876c2aed4ffd69 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -587,7 +587,7 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
{"izext", {{"i", AnyInt}}, TypePattern{IntType, KindCode::exactKind, 2}},
{"jzext", {{"i", AnyInt}}, DefaultInt},
{"kind",
- {{"x", AnyIntrinsic, Rank::elemental, Optionality::required,
+ {{"x", AnyIntrinsic, Rank::anyOrAssumedRank, Optionality::required,
common::Intent::In, {ArgFlag::canBeMoldNull}}},
DefaultInt, Rank::elemental, IntrinsicClass::inquiryFunction},
{"lbound",
diff --git a/flang/test/Evaluate/fold-assumed-rank-kind.f90 b/flang/test/Evaluate/fold-assumed-rank-kind.f90
new file mode 100644
index 00000000000000..674f60c6a0e2ff
--- /dev/null
+++ b/flang/test/Evaluate/fold-assumed-rank-kind.f90
@@ -0,0 +1,6 @@
+! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
+subroutine subr(ar)
+ real(8) :: ar(..)
+!CHECK: PRINT *, 8_4
+ print *, kind(ar)
+end
More information about the flang-commits
mailing list