[flang-commits] [flang] [flang][runtime] Establish derived type desc properly. (PR #67623)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Thu Sep 28 08:56:50 PDT 2023
================
@@ -96,12 +96,19 @@ void Descriptor::Establish(const typeInfo::DerivedType &dt, void *p, int rank,
OwningPtr<Descriptor> Descriptor::Create(TypeCode t, std::size_t elementBytes,
void *p, int rank, const SubscriptValue *extent,
- ISO::CFI_attribute_t attribute, int derivedTypeLenParameters) {
- std::size_t bytes{SizeInBytes(rank, true, derivedTypeLenParameters)};
+ ISO::CFI_attribute_t attribute, bool addendum,
+ const typeInfo::DerivedType *dt) {
Terminator terminator{__FILE__, __LINE__};
+ RUNTIME_CHECK(terminator, t.IsDerived() == (dt != nullptr));
+ int derivedTypeLenParameters = dt ? dt->LenParameters() : 0;
+ std::size_t bytes{SizeInBytes(rank, addendum, derivedTypeLenParameters)};
Descriptor *result{
reinterpret_cast<Descriptor *>(AllocateMemoryOrCrash(terminator, bytes))};
- result->Establish(t, elementBytes, p, rank, extent, attribute, true);
----------------
klausler wrote:
Surely it (`c`) needs an addendum, unless its descriptor is dynamically allocated as well. And we're going to want to have a way to distinguish an unlimited polymorphic unallocated/unassociated entity from one that has a declared type.
https://github.com/llvm/llvm-project/pull/67623
More information about the flang-commits
mailing list