diff --git a/flang/runtime/pointer.cpp b/flang/runtime/pointer.cpp --- a/flang/runtime/pointer.cpp +++ b/flang/runtime/pointer.cpp @@ -101,12 +101,7 @@ boundElementBytes, terminator), GetInt64(bounds.ZeroBasedIndexedElement(2 * j + 1), boundElementBytes, terminator)); - if (j == 0) { - byteStride = dim.ByteStride(); - } else { - dim.SetByteStride(byteStride); - byteStride *= dim.Extent(); - } + dim.SetByteStride(target.GetDimension(j).ByteStride()); } if (pointer.Elements() > target.Elements()) { terminator.Crash("PointerAssociateRemapping: too many elements in remapped "