[flang-commits] [PATCH] D149062: [flang][runtime] Fix padding in CHARACTER(4) assignments.

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Apr 25 00:06:47 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ac31a0bfa28: [flang][runtime] Fix padding in CHARACTER(4) assignments. (authored by jeanPerier).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149062/new/

https://reviews.llvm.org/D149062

Files:
  flang/runtime/assign.cpp


Index: flang/runtime/assign.cpp
===================================================================
--- flang/runtime/assign.cpp
+++ flang/runtime/assign.cpp
@@ -223,12 +223,13 @@
     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{' '};
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149062.516644.patch
Type: text/x-patch
Size: 823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230425/fb71e097/attachment.bin>


More information about the flang-commits mailing list