[PATCH] D106831: [flang] Disallow BOZ literal constants as arguments of implicit interfaces
Pete Steinfeld via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 26 14:29:24 PDT 2021
PeteSteinfeld created this revision.
PeteSteinfeld requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D106831
Files:
flang/lib/Semantics/check-call.cpp
flang/test/Semantics/boz-literal-constants.f90
Index: flang/test/Semantics/boz-literal-constants.f90
===================================================================
--- flang/test/Semantics/boz-literal-constants.f90
+++ flang/test/Semantics/boz-literal-constants.f90
@@ -77,4 +77,7 @@
res = MERGE_BITS(B"1101",3,B"1011")
res = REAL(B"1101")
+
+ !ERROR: BOZ argument not allowed in an implicit interface
+ call implictSub(Z'12345')
end subroutine
Index: flang/lib/Semantics/check-call.cpp
===================================================================
--- flang/lib/Semantics/check-call.cpp
+++ flang/lib/Semantics/check-call.cpp
@@ -46,6 +46,10 @@
}
}
if (const auto *expr{arg.UnwrapExpr()}) {
+ if (std::holds_alternative<evaluate::BOZLiteralConstant>(expr->u)) {
+ messages.Say(
+ "BOZ argument not allowed in an implicit interface"_err_en_US);
+ }
if (auto named{evaluate::ExtractNamedEntity(*expr)}) {
const Symbol &symbol{named->GetLastSymbol()};
if (symbol.Corank() > 0) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106831.361807.patch
Type: text/x-patch
Size: 1002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210726/806f7444/attachment.bin>
More information about the llvm-commits
mailing list