[flang-commits] [flang] 8f41431 - [flang] Disallow BOZ literal constants as arguments of implicit interfaces
Peter Steinfeld via flang-commits
flang-commits at lists.llvm.org
Mon Jul 26 15:07:10 PDT 2021
Author: Peter Steinfeld
Date: 2021-07-26T15:04:05-07:00
New Revision: 8f41431654fedac4a5ad2751056a611bfc7751f0
URL: https://github.com/llvm/llvm-project/commit/8f41431654fedac4a5ad2751056a611bfc7751f0
DIFF: https://github.com/llvm/llvm-project/commit/8f41431654fedac4a5ad2751056a611bfc7751f0.diff
LOG: [flang] Disallow BOZ literal constants as arguments of implicit interfaces
Since BOZ literal arguments are typeless, we cannot know how to pass them as
actual arguments to procedures with implicit interfaces. This change avoids
the problem by emitting an error message in such situations.
This change stemmed from the following issue --
https://github.com/flang-compiler/f18-llvm-project/issues/794
Differential Revision: https://reviews.llvm.org/D106831
Added:
Modified:
flang/lib/Semantics/check-call.cpp
flang/test/Semantics/boz-literal-constants.f90
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp
index 5a358c46f31f6..77fc25b44f6e4 100644
--- a/flang/lib/Semantics/check-call.cpp
+++ b/flang/lib/Semantics/check-call.cpp
@@ -46,6 +46,9 @@ static void CheckImplicitInterfaceArg(
}
}
if (const auto *expr{arg.UnwrapExpr()}) {
+ if (std::holds_alternative<evaluate::BOZLiteralConstant>(expr->u)) {
+ messages.Say("BOZ argument requires an explicit interface"_err_en_US);
+ }
if (auto named{evaluate::ExtractNamedEntity(*expr)}) {
const Symbol &symbol{named->GetLastSymbol()};
if (symbol.Corank() > 0) {
diff --git a/flang/test/Semantics/boz-literal-constants.f90 b/flang/test/Semantics/boz-literal-constants.f90
index 1de7c06fb4e2f..8636a31e705f1 100644
--- a/flang/test/Semantics/boz-literal-constants.f90
+++ b/flang/test/Semantics/boz-literal-constants.f90
@@ -77,4 +77,7 @@ subroutine bozchecks
res = MERGE_BITS(B"1101",3,B"1011")
res = REAL(B"1101")
+
+ !ERROR: BOZ argument requires an explicit interface
+ call implictSub(Z'12345')
end subroutine
More information about the flang-commits
mailing list