[flang-commits] [PATCH] D154750: [flang][runtime] Fix BACKSPACE over an empty record

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jul 7 15:55:15 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG16e61eb0c4d3: [flang][runtime] Fix BACKSPACE over an empty record (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154750

Files:
  flang/runtime/unit.cpp


Index: flang/runtime/unit.cpp
===================================================================
--- flang/runtime/unit.cpp
+++ flang/runtime/unit.cpp
@@ -843,7 +843,7 @@
 // There's no portable memrchr(), unfortunately, and strrchr() would
 // fail on a record with a NUL, so we have to do it the hard way.
 static const char *FindLastNewline(const char *str, std::size_t length) {
-  for (const char *p{str + length}; p-- > str;) {
+  for (const char *p{str + length}; p >= str; p--) {
     if (*p == '\n') {
       return p;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154750.538291.patch
Type: text/x-patch
Size: 536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230707/d2da78ac/attachment-0001.bin>


More information about the flang-commits mailing list