[flang-commits] [flang] [flang] Expand parent component in procedure pointer component refere… (PR #78593)
via flang-commits
flang-commits at lists.llvm.org
Thu Jan 18 09:29:38 PST 2024
================
@@ -2391,9 +2393,15 @@ auto ExpressionAnalyzer::AnalyzeProcedureComponentRef(
ProcedureDesignator{*resolution}, std::move(arguments)};
} else if (dataRef.has_value()) {
if (sym->attrs().test(semantics::Attr::NOPASS)) {
- return CalleeAndArguments{
- ProcedureDesignator{Component{std::move(*dataRef), *sym}},
- std::move(arguments)};
+ const auto *dtSpec{GetDerivedTypeSpec(dtExpr->GetType())};
+ if (dtSpec && dtSpec->scope()) {
+ if (auto component{CreateComponent(std::move(*dataRef), *sym,
+ *dtSpec->scope(), /*C919AlreadyEnforced=*/true)}) {
+ return CalleeAndArguments{
+ ProcedureDesignator{std::move(*component)},
+ std::move(arguments)};
+ }
+ }
----------------
jeanPerier wrote:
CalleeAndArgument ctor is not doing any extra semantics checking as far as I see, so if component cannot be created, something is wrong with the base/component and I do not see the point of attempting to build some invalid CalleeAndArguments.
All the kind of bad code I can think of do not reach the fallthrough, but better safe than sorry, I added an error in the fallthrough and returned nullopt (the later fallthrough would also emit error "Base of procedure component reference is not a derived-type object", but I do not think it would be correct if that point was reached).
https://github.com/llvm/llvm-project/pull/78593
More information about the flang-commits
mailing list