diff --git a/flang/runtime/edit-input.cpp b/flang/runtime/edit-input.cpp --- a/flang/runtime/edit-input.cpp +++ b/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(*input); + --length; + } + --remaining; + } else { // single bytes -> default CHARACTER if (skipping) { chunk = std::min(skip, ready); skip -= chunk;