forked from OSchip/llvm-project
[flang][runtime] Handle READ of non-UTF-8 data into multi-byte CHARACTER
When a READ statement reads into a CHARACTER(2 or 4) variable from a unit whose encoding is not UTF-8, don't copy bytes directly; they must each be zero-extended. Differential Revision: https://reviews.llvm.org/D128390
This commit is contained in:
parent
b257acd266
commit
ede4213169
|
@ -730,7 +730,17 @@ bool EditCharacterInput(
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue