[flang-commits] [PATCH] D145753: [flang][runtime] Use Descriptor::Establish() in elemental derived type defined assignment calls

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Mar 10 10:30:59 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9c3550f69a0d: [flang][runtime] Use Descriptor::Establish() in elemental derived type defined… (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145753/new/

https://reviews.llvm.org/D145753

Files:
  flang/runtime/assign.cpp


Index: flang/runtime/assign.cpp
===================================================================
--- flang/runtime/assign.cpp
+++ flang/runtime/assign.cpp
@@ -199,19 +199,17 @@
 }
 
 static void DoElementalDefinedAssignment(const Descriptor &to,
-    const Descriptor &from, const typeInfo::SpecialBinding &special) {
+    const Descriptor &from, const typeInfo::DerivedType &derived,
+    const typeInfo::SpecialBinding &special) {
   SubscriptValue toAt[maxRank], fromAt[maxRank];
   to.GetLowerBounds(toAt);
   from.GetLowerBounds(fromAt);
   StaticDescriptor<maxRank, true, 8 /*?*/> statDesc[2];
   Descriptor &toElementDesc{statDesc[0].descriptor()};
   Descriptor &fromElementDesc{statDesc[1].descriptor()};
-  toElementDesc = to;
-  toElementDesc.raw().attribute = CFI_attribute_pointer;
-  toElementDesc.raw().rank = 0;
-  fromElementDesc = from;
-  fromElementDesc.raw().attribute = CFI_attribute_pointer;
-  fromElementDesc.raw().rank = 0;
+  toElementDesc.Establish(derived, nullptr, 0, nullptr, CFI_attribute_pointer);
+  fromElementDesc.Establish(
+      derived, nullptr, 0, nullptr, CFI_attribute_pointer);
   for (std::size_t toElements{to.Elements()}; toElements-- > 0;
        to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
     toElementDesc.set_base_addr(to.Element<char>(toAt));
@@ -268,7 +266,7 @@
       }
       if (const auto *special{toDerived->FindSpecialBinding(
               typeInfo::SpecialBinding::Which::ElementalAssignment)}) {
-        return DoElementalDefinedAssignment(to, from, *special);
+        return DoElementalDefinedAssignment(to, from, *toDerived, *special);
       }
     }
     if ((flags & NeedFinalization) && toDerived->noFinalizationNeeded()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145753.504213.patch
Type: text/x-patch
Size: 1722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230310/71f2ec5e/attachment.bin>


More information about the flang-commits mailing list