mirror of
https://github.com/intel/llvm.git
synced 2026-02-01 17:07:36 +08:00
[flang] Retrieve rank before updating the pointer
The code is iterating on the rank of the pointer to set the bounds. If the rank is retrieved after the `pointer = target` it does not reflect the actual rank of the pointer. This could happen in code like the following: ``` type t1 integer :: a end type type(t), pointer :: p(:) class(t), pointer :: q(:,:) q(0:1,-2:2) => p(10:1:-1) ``` Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D139327
This commit is contained in:
@@ -87,9 +87,9 @@ void RTNAME(PointerAssociateLowerBounds)(Descriptor &pointer,
|
||||
void RTNAME(PointerAssociateRemapping)(Descriptor &pointer,
|
||||
const Descriptor &target, const Descriptor &bounds, const char *sourceFile,
|
||||
int sourceLine) {
|
||||
int rank{pointer.rank()};
|
||||
pointer = target;
|
||||
pointer.raw().attribute = CFI_attribute_pointer;
|
||||
int rank{pointer.rank()};
|
||||
Terminator terminator{sourceFile, sourceLine};
|
||||
SubscriptValue byteStride{/*captured from first dimension*/};
|
||||
std::size_t boundElementBytes{bounds.ElementBytes()};
|
||||
|
||||
Reference in New Issue
Block a user