[flang-commits] [PATCH] D128390: [flang][runtime] Handle READ of non-UTF-8 data into multi-byte CHARACTER

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Jun 23 10:02:32 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGede421316948: [flang][runtime] Handle READ of non-UTF-8 data into multi-byte CHARACTER (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128390

Files:
  flang/runtime/edit-input.cpp


Index: flang/runtime/edit-input.cpp
===================================================================
--- flang/runtime/edit-input.cpp
+++ flang/runtime/edit-input.cpp
@@ -730,7 +730,17 @@
         chunk = 1;
       }
       --remaining;
-    } else {
+    } else if constexpr (sizeof *x > 1) {
+      // Read single byte with expansion into multi-byte CHARACTER
+      chunk = 1;
+      if (skipping) {
+        --skip;
+      } else {
+        *x++ = static_cast<unsigned char>(*input);
+        --length;
+      }
+      --remaining;
+    } else { // single bytes -> default CHARACTER
       if (skipping) {
         chunk = std::min<std::size_t>(skip, ready);
         skip -= chunk;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128390.439445.patch
Type: text/x-patch
Size: 690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220623/aee1d514/attachment.bin>


More information about the flang-commits mailing list