[flang-commits] [flang] ac84bc3 - [flang] Carry over the derived type from target in pointer remapping

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Mon Feb 20 00:44:45 PST 2023


Author: Valentin Clement
Date: 2023-02-20T09:44:39+01:00
New Revision: ac84bc3cd407d95df9031e0dc02ad62969298ff6

URL: https://github.com/llvm/llvm-project/commit/ac84bc3cd407d95df9031e0dc02ad62969298ff6
DIFF: https://github.com/llvm/llvm-project/commit/ac84bc3cd407d95df9031e0dc02ad62969298ff6.diff

LOG: [flang] Carry over the derived type from target in pointer remapping

When calling PointerAssociateRemapping the dynamic type information
from the target needs to be carried over to the pointer if any.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D143717

Added: 
    

Modified: 
    flang/runtime/pointer.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/pointer.cpp b/flang/runtime/pointer.cpp
index bae9e0327d9a0..4cf8e92eb5add 100644
--- a/flang/runtime/pointer.cpp
+++ b/flang/runtime/pointer.cpp
@@ -121,6 +121,13 @@ void RTNAME(PointerAssociateRemapping)(Descriptor &pointer,
                      "pointer (%zd > %zd)",
         pointer.Elements(), target.Elements());
   }
+  if (auto *pointerAddendum{pointer.Addendum()}) {
+    if (const auto *targetAddendum{target.Addendum()}) {
+      if (const auto *derived{targetAddendum->derivedType()}) {
+        pointerAddendum->set_derivedType(derived);
+      }
+    }
+  }
 }
 
 int RTNAME(PointerAllocate)(Descriptor &pointer, bool hasStat,


        


More information about the flang-commits mailing list