diff --git a/flang/runtime/derived.cpp b/flang/runtime/derived.cpp --- a/flang/runtime/derived.cpp +++ b/flang/runtime/derived.cpp @@ -48,7 +48,7 @@ // non-allocatable non-automatic components std::size_t bytes{comp.SizeInBytes(instance)}; for (std::size_t j{0}; j < elements; ++j) { - char *ptr{instance.OffsetElement(j * byteStride + comp.offset())}; + char *ptr{instance.ZeroBasedIndexedElement(j) + comp.offset()}; std::memcpy(ptr, init, bytes); } } else if (comp.genre() == typeInfo::Component::Genre::Data &&