[flang-commits] [flang] [flang][runtime] Finalize polymorphic components using dynamic type (PR #67040)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Thu Sep 21 10:04:19 PDT 2023
================
@@ -209,7 +209,25 @@ void Finalize(const Descriptor &descriptor,
k < myComponents; ++k) {
const auto &comp{
*componentDesc.ZeroBasedIndexedElement<typeInfo::Component>(k)};
- if (comp.genre() == typeInfo::Component::Genre::Allocatable ||
+ if (comp.genre() == typeInfo::Component::Genre::Allocatable &&
+ comp.category() == TypeCategory::Derived) {
+ // Component may be polymorphic or unlimited polymorphic. Need to use the
+ // dynamic type to check if finalization is needed.
----------------
klausler wrote:
"check whether" is preferable to "check if" here.
https://github.com/llvm/llvm-project/pull/67040
More information about the flang-commits
mailing list