Skip to content

Commit cf99e58

Browse files
committed
[flang] Omit parent components for references to bindings
llvm#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).
1 parent 83ca78d commit cf99e58

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flang/lib/Semantics/expression.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,15 +1299,17 @@ static NamedEntity IgnoreAnySubscripts(Designator<SomeDerived> &&designator) {
12991299
std::move(designator.u));
13001300
}
13011301

1302-
// Components of parent derived types are explicitly represented as such.
1302+
// Components, but not bindings, of parent derived types are explicitly
1303+
// represented as such.
13031304
std::optional<Component> ExpressionAnalyzer::CreateComponent(DataRef &&base,
13041305
const Symbol &component, const semantics::Scope &scope,
13051306
bool C919bAlreadyEnforced) {
13061307
if (!C919bAlreadyEnforced && IsAllocatableOrPointer(component) &&
13071308
base.Rank() > 0) { // C919b
13081309
Say("An allocatable or pointer component reference must be applied to a scalar base"_err_en_US);
13091310
}
1310-
if (&component.owner() == &scope) {
1311+
if (&component.owner() == &scope ||
1312+
component.has<semantics::ProcBindingDetails>()) {
13111313
return Component{std::move(base), component};
13121314
}
13131315
if (const Symbol *typeSymbol{scope.GetSymbol()}) {

0 commit comments

Comments
 (0)