Do not use ultimate symbols in DescriptorInquiry. Using the ultimate
symbol may lead to issues later for at least two reasons:
- The original symbols may have volatile/asynchronous attributes that
the ultimate may not have. Later phases working on the DescriptorInquiry
would then not apply potential care required by these attributes.
- HostAssociatedDetails symbols are used by OpenMP for symbols with
special OpenMP attributes inside OpenMP region (e.g variables with
private attribute), so it is very important to preserve this
aspect in the DescriptorInquiry, that would otherwise apply on the
symbol outside of the region.
Differential Revision: https://reviews.llvm.org/D104385
[&](const semantics::ProcBindingDetails &binding) {
return (*this)(binding.symbol());
},
- [&](const semantics::UseDetails &use) {
- return (*this)(use.symbol());
- },
- [&](const semantics::HostAssocDetails &assoc) {
- return (*this)(assoc.symbol());
- },
[](const semantics::TypeParamDetails &) { return ScalarShape(); },
[](const auto &) { return Result{}; },
},
- symbol.details());
+ symbol.GetUltimate().details());
}
auto GetShapeHelper::operator()(const Component &component) const -> Result {
return len;
} else if (IsDescriptor(ultimate) && !ultimate.owner().IsDerivedType()) {
return Expr<SubscriptInteger>{DescriptorInquiry{
- NamedEntity{ultimate}, DescriptorInquiry::Field::Len}};
+ NamedEntity{symbol}, DescriptorInquiry::Field::Len}};
}
}
return std::nullopt;