[flang-commits] [PATCH] D127024: [flang][runtime] Don't crash after surviving internal output overflow

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Sat Jun 4 08:55:43 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGea5b205bb895: [flang][runtime] Don't crash after surviving internal output overflow (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127024

Files:
  flang/runtime/internal-unit.cpp


Index: flang/runtime/internal-unit.cpp
===================================================================
--- flang/runtime/internal-unit.cpp
+++ flang/runtime/internal-unit.cpp
@@ -41,7 +41,9 @@
   if constexpr (DIR == Direction::Output) {
     // Clear the remainder of the current record if anything was written
     // to it, or if it is the only record.
-    if (endfileRecordNumber.value_or(-1) == 2 || furthestPositionInRecord > 0) {
+    auto end{endfileRecordNumber.value_or(0)};
+    if (currentRecordNumber < end &&
+        (end == 2 || furthestPositionInRecord > 0)) {
       BlankFillOutputRecord();
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127024.434267.patch
Type: text/x-patch
Size: 627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220604/4a3c6995/attachment.bin>


More information about the flang-commits mailing list