[flang-commits] [PATCH] D127792: [flang][runtime] Fix handling of output FORMAT('x' 'y')

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 14 14:01:18 PDT 2022


klausler created this revision.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

I'm emitting "x'y" because the space-separated apostrophes are
misinterpreted as being adjacent repeated quotation marks.
Fix to ensure no space skipping is applied when checking for
repeated quotation marks.


https://reviews.llvm.org/D127792

Files:
  flang/runtime/format-implementation.h


Index: flang/runtime/format-implementation.h
===================================================================
--- flang/runtime/format-implementation.h
+++ flang/runtime/format-implementation.h
@@ -293,7 +293,7 @@
       ++offset_;
       std::size_t chars{
           static_cast<std::size_t>(&format_[offset_] - &format_[start])};
-      if (PeekNext() == quote) {
+      if (offset_ < formatLength_ && format_[offset_] == quote) {
         // subtle: handle doubled quote character in a literal by including
         // the first in the output, then treating the second as the start
         // of another character literal.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127792.436925.patch
Type: text/x-patch
Size: 631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220614/17040255/attachment.bin>


More information about the flang-commits mailing list