const Symbol &symbol, bool entire) -> SizeAndAlignment {
auto &targetCharacteristics{context_.targetCharacteristics()};
if (IsDescriptor(symbol)) {
- const auto *derived{
- evaluate::GetDerivedTypeSpec(evaluate::DynamicType::From(symbol))};
+ auto dyType{evaluate::DynamicType::From(symbol)};
+ const auto *derived{evaluate::GetDerivedTypeSpec(dyType)};
int lenParams{derived ? CountLenParameters(*derived) : 0};
+ bool needAddendum{derived || (dyType && dyType->IsUnlimitedPolymorphic())};
std::size_t size{runtime::Descriptor::SizeInBytes(
- symbol.Rank(), derived != nullptr, lenParams)};
+ symbol.Rank(), needAddendum, lenParams)};
return {size, targetCharacteristics.descriptorAlignment()};
}
if (IsProcedurePointer(symbol)) {
std::size_t elements{instance.Elements()};
std::size_t byteStride{instance.ElementBytes()};
int stat{StatOk};
- // Initialize data components in each element; the per-element iteration
- // constitutes the inner loops, not outer
+ // Initialize data components in each element; the per-element iterations
+ // constitute the inner loops, not the outer ones
std::size_t myComponents{componentDesc.Elements()};
for (std::size_t k{0}; k < myComponents; ++k) {
const auto &comp{
if (comp.genre() == typeInfo::Component::Genre::Automatic) {
stat = ReturnError(terminator, allocDesc.Allocate(), errMsg, hasStat);
if (stat == StatOk) {
- stat = Initialize(allocDesc, derived, terminator, hasStat, errMsg);
+ if (const DescriptorAddendum * addendum{allocDesc.Addendum()}) {
+ if (const auto *derived{addendum->derivedType()}) {
+ if (!derived->noInitializationNeeded()) {
+ stat = Initialize(
+ allocDesc, *derived, terminator, hasStat, errMsg);
+ }
+ }
+ }
}
if (stat != StatOk) {
break;