Skip to content

Commit ccfb9e6

Browse files
authored
[flang] Omit parent components for references to bindings (#84836)
#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 ea848d0 commit ccfb9e6

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
@@ -1302,15 +1302,17 @@ static NamedEntity IgnoreAnySubscripts(Designator<SomeDerived> &&designator) {
13021302
std::move(designator.u));
13031303
}
13041304

1305-
// Components of parent derived types are explicitly represented as such.
1305+
// Components, but not bindings, of parent derived types are explicitly
1306+
// represented as such.
13061307
std::optional<Component> ExpressionAnalyzer::CreateComponent(DataRef &&base,
13071308
const Symbol &component, const semantics::Scope &scope,
13081309
bool C919bAlreadyEnforced) {
13091310
if (!C919bAlreadyEnforced && IsAllocatableOrPointer(component) &&
13101311
base.Rank() > 0) { // C919b
13111312
Say("An allocatable or pointer component reference must be applied to a scalar base"_err_en_US);
13121313
}
1313-
if (&component.owner() == &scope) {
1314+
if (&component.owner() == &scope ||
1315+
component.has<semantics::ProcBindingDetails>()) {
13141316
return Component{std::move(base), component};
13151317
}
13161318
if (const Symbol *typeSymbol{scope.GetSymbol()}) {

0 commit comments

Comments
 (0)