[flang-commits] [flang] 290cc4f - [flang] Prevent crash in error case: elemental with alternate return
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Dec 16 16:45:59 PST 2022
Author: Peter Klausler
Date: 2022-12-16T16:45:51-08:00
New Revision: 290cc4fe17e179a6165908ae23609a7b639bfad3
URL: https://github.com/llvm/llvm-project/commit/290cc4fe17e179a6165908ae23609a7b639bfad3
DIFF: https://github.com/llvm/llvm-project/commit/290cc4fe17e179a6165908ae23609a7b639bfad3.diff
LOG: [flang] Prevent crash in error case: elemental with alternate return
When an ELEMENTAL subroutine is erroneously declared with alternate return
arguments, don't crash when checking the ranks of the actual arguments.
Differential Revision: https://reviews.llvm.org/D140143
Added:
Modified:
flang/lib/Semantics/check-call.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp
index 76cb96ced3f4a..104ea7acb8d37 100644
--- a/flang/lib/Semantics/check-call.cpp
+++ b/flang/lib/Semantics/check-call.cpp
@@ -891,7 +891,7 @@ static bool CheckElementalConformance(parser::ContextualMessages &messages,
int index{0};
bool hasArrayArg{false};
for (const auto &arg : actuals) {
- if (arg && arg.value().Rank() > 0) {
+ if (arg && !arg->isAlternateReturn() && arg->Rank() > 0) {
hasArrayArg = true;
break;
}
More information about the flang-commits
mailing list