[flang-commits] [PATCH] D112351: [flang] Fix crash on empty formatted external READs

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Oct 22 15:52:47 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGce71f8e01742: [flang] Fix crash on empty formatted external READs (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112351

Files:
  flang/runtime/io-stmt.cpp


Index: flang/runtime/io-stmt.cpp
===================================================================
--- flang/runtime/io-stmt.cpp
+++ flang/runtime/io-stmt.cpp
@@ -388,6 +388,9 @@
 
 template <Direction DIR, typename CHAR>
 int ExternalFormattedIoStatementState<DIR, CHAR>::EndIoStatement() {
+  if constexpr (DIR == Direction::Input) {
+    this->BeginReadingRecord(); // in case there were no I/O items
+  }
   format_.Finish(*this);
   return ExternalIoStatementState<DIR>::EndIoStatement();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112351.381674.patch
Type: text/x-patch
Size: 499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20211022/c12a378a/attachment-0001.bin>


More information about the flang-commits mailing list