Skip to content

Commit

Permalink
[flang] Omit parent components for references to bindings (#84836)
Browse files Browse the repository at this point in the history
#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).
  • Loading branch information
klausler committed Mar 13, 2024
1 parent ea848d0 commit ccfb9e6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flang/lib/Semantics/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1302,15 +1302,17 @@ 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) {
if (!C919bAlreadyEnforced && IsAllocatableOrPointer(component) &&
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()}) {
Expand Down

0 comments on commit ccfb9e6

Please sign in to comment.