aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flang/runtime/assign.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/flang/runtime/assign.cpp b/flang/runtime/assign.cpp
index 095c4d3b..0b64020 100644
--- a/flang/runtime/assign.cpp
+++ b/flang/runtime/assign.cpp
@@ -223,12 +223,13 @@ static void BlankPadCharacterAssignment(Descriptor &to, const Descriptor &from,
SubscriptValue toAt[], SubscriptValue fromAt[], std::size_t elements,
std::size_t toElementBytes, std::size_t fromElementBytes) {
std::size_t padding{(toElementBytes - fromElementBytes) / sizeof(CHAR)};
+ std::size_t copiedCharacters{fromElementBytes / sizeof(CHAR)};
for (; elements-- > 0;
to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
CHAR *p{to.Element<CHAR>(toAt)};
std::memmove(
p, from.Element<std::add_const_t<CHAR>>(fromAt), fromElementBytes);
- p += fromElementBytes;
+ p += copiedCharacters;
for (auto n{padding}; n-- > 0;) {
*p++ = CHAR{' '};
}