[flang-commits] [flang] ccfb9e6 - [flang] Omit parent components for references to bindings (#84836)
via flang-commits
flang-commits at lists.llvm.org
Wed Mar 13 14:30:08 PDT 2024
Author: Peter Klausler
Date: 2024-03-13T14:30:04-07:00
New Revision: ccfb9e6eb7429885e6d09e99cf89bce41f1ca3cc
URL: https://github.com/llvm/llvm-project/commit/ccfb9e6eb7429885e6d09e99cf89bce41f1ca3cc
DIFF: https://github.com/llvm/llvm-project/commit/ccfb9e6eb7429885e6d09e99cf89bce41f1ca3cc.diff
LOG: [flang] Omit parent components for references to bindings (#84836)
https://github.com/llvm/llvm-project/pull/78593 changed expression
semantics to always include the names of parent components that were
necessary to access an inherited component. This turns out to have
broken calls to inherited NOPASS procedure bindings. Update the patch to
omit explicit parent components when accessing bindings, while retaining
them for component accesses (including procedure components).
Added:
Modified:
flang/lib/Semantics/expression.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp
index 1015a9e6efcef8..6af86de9dd81cb 100644
--- a/flang/lib/Semantics/expression.cpp
+++ b/flang/lib/Semantics/expression.cpp
@@ -1302,7 +1302,8 @@ static NamedEntity IgnoreAnySubscripts(Designator<SomeDerived> &&designator) {
std::move(designator.u));
}
-// Components of parent derived types are explicitly represented as such.
+// Components, but not bindings, of parent derived types are explicitly
+// represented as such.
std::optional<Component> ExpressionAnalyzer::CreateComponent(DataRef &&base,
const Symbol &component, const semantics::Scope &scope,
bool C919bAlreadyEnforced) {
@@ -1310,7 +1311,8 @@ std::optional<Component> ExpressionAnalyzer::CreateComponent(DataRef &&base,
base.Rank() > 0) { // C919b
Say("An allocatable or pointer component reference must be applied to a scalar base"_err_en_US);
}
- if (&component.owner() == &scope) {
+ if (&component.owner() == &scope ||
+ component.has<semantics::ProcBindingDetails>()) {
return Component{std::move(base), component};
}
if (const Symbol *typeSymbol{scope.GetSymbol()}) {
More information about the flang-commits
mailing list