[flang-commits] [PATCH] D142765: [flang] If it's got an argument keyword, it can't become an array reference
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Sun Jan 29 08:41:07 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeb1bd7086aba: [flang] If it's got an argument keyword, it can't become an array reference (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142765/new/
https://reviews.llvm.org/D142765
Files:
flang/lib/Semantics/expression.cpp
flang/test/Semantics/call32.f90
Index: flang/test/Semantics/call32.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/call32.f90
@@ -0,0 +1,8 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1 -Werror
+! Ensure that a seemingly misparsed function reference is
+! not converted to an array references of the same name if
+! there's an argument keyword.
+real array(1)
+!ERROR: 'array' is not a callable procedure
+print *, array(argument=1)
+end
Index: flang/lib/Semantics/expression.cpp
===================================================================
--- flang/lib/Semantics/expression.cpp
+++ flang/lib/Semantics/expression.cpp
@@ -3247,6 +3247,13 @@
if (auto *func{
std::get_if<common::Indirection<parser::FunctionReference>>(&u)}) {
parser::FunctionReference &funcRef{func->value()};
+ // Ensure that there are no argument keywords
+ for (const auto &arg :
+ std::get<std::list<parser::ActualArgSpec>>(funcRef.v.t)) {
+ if (std::get<std::optional<parser::Keyword>>(arg.t)) {
+ return;
+ }
+ }
auto &proc{std::get<parser::ProcedureDesignator>(funcRef.v.t)};
if (Symbol *origSymbol{
common::visit(common::visitors{
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142765.493100.patch
Type: text/x-patch
Size: 1223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230129/49cff8c7/attachment.bin>
More information about the flang-commits
mailing list