Skip to content

Commit

Permalink
[flang] Carry over the derived type from target in pointer remapping
Browse files Browse the repository at this point in the history
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
  • Loading branch information
clementval committed Feb 20, 2023
1 parent a4d6c7d commit ac84bc3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flang/runtime/pointer.cpp
Expand Up @@ -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,
Expand Down

0 comments on commit ac84bc3

Please sign in to comment.