[PATCH] D94017: [flang] Fix bogus message on internal subprogram with alternate return
Pete Steinfeld via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 4 09:46:35 PST 2021
PeteSteinfeld created this revision.
PeteSteinfeld added reviewers: klausler, tskeith.
PeteSteinfeld requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Internal subprograms have explicit interfaces. If an internal subprogram has
an alternate return, we check its explicit interface. But our explicit
interface checking was not allowing for alternate returns.
I fixed this by checking to see if the dummy argument was an alternate return.
I also added the test altreturn06.f90.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94017
Files:
flang/lib/Semantics/check-call.cpp
flang/test/Semantics/altreturn06.f90
Index: flang/test/Semantics/altreturn06.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/altreturn06.f90
@@ -0,0 +1,11 @@
+! RUN: %S/test_errors.sh %s %t %f18
+! Test argument passing for internal and external subprograms
+! Both of the following are OK
+ call extSubprogram (*100)
+ call intSubprogram (*100)
+100 PRINT *,'First alternate return'
+contains
+ subroutine intSubprogram(*)
+ return(1)
+ end subroutine
+end
Index: flang/lib/Semantics/check-call.cpp
===================================================================
--- flang/lib/Semantics/check-call.cpp
+++ flang/lib/Semantics/check-call.cpp
@@ -719,7 +719,8 @@
if (actual) {
CheckExplicitInterfaceArg(
*actual, dummy, proc, localContext, scope, intrinsic);
- } else if (!dummy.IsOptional()) {
+ } else if (!dummy.IsOptional() &&
+ !std::holds_alternative<characteristics::AlternateReturn>(dummy.u)) {
if (dummy.name.empty()) {
messages.Say(
"Dummy argument #%d is not OPTIONAL and is not associated with "
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94017.314399.patch
Type: text/x-patch
Size: 1127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210104/9ea50493/attachment.bin>
More information about the llvm-commits
mailing list