[flang-commits] [PATCH] D125056: [flang][runtime] (G0) for CHARACTER means (A), not (A0)
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu May 5 16:19:12 PDT 2022
klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.
I'm emitting zero characters for (G0) formatting of CHARACTER values
instead of using their lengths to determine the output field width.
https://reviews.llvm.org/D125056
Files:
flang/runtime/edit-output.cpp
Index: flang/runtime/edit-output.cpp
===================================================================
--- flang/runtime/edit-output.cpp
+++ flang/runtime/edit-output.cpp
@@ -627,9 +627,15 @@
template <typename CHAR>
bool EditCharacterOutput(IoStatementState &io, const DataEdit &edit,
const CHAR *x, std::size_t length) {
+ int len{static_cast<int>(length)};
+ int width{edit.width.value_or(len)};
switch (edit.descriptor) {
case 'A':
+ break;
case 'G':
+ if (width == 0) {
+ width = len;
+ }
break;
case 'B':
return EditBOZOutput<1>(io, edit,
@@ -646,8 +652,6 @@
edit.descriptor);
return false;
}
- int len{static_cast<int>(length)};
- int width{edit.width.value_or(len)};
return io.EmitRepeated(' ', std::max(0, width - len)) &&
io.EmitEncoded(x, std::min(width, len));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125056.427486.patch
Type: text/x-patch
Size: 852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220505/6956c0e8/attachment-0001.bin>
More information about the flang-commits
mailing list