[flang-commits] [PATCH] D117903: [flang] Don't drop format string for external child I/O

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Sat Jan 22 09:01:21 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe9d0f8baf236: [flang] Don't drop format string for external child I/O (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D117903?vs=402015&id=402223#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117903

Files:
  flang/runtime/format-implementation.h
  flang/runtime/io-api.cpp
  flang/runtime/io-error.cpp


Index: flang/runtime/io-error.cpp
===================================================================
--- flang/runtime/io-error.cpp
+++ flang/runtime/io-error.cpp
@@ -59,10 +59,14 @@
 
 void IoErrorHandler::Forward(
     int ioStatOrErrno, const char *msg, std::size_t length) {
-  SignalError(ioStatOrErrno);
-  if (ioStat_ != IostatOk && (flags_ & hasIoMsg)) {
+  if (ioStat_ != IostatOk && msg && (flags_ & hasIoMsg)) {
     ioMsg_ = SaveDefaultCharacter(msg, length, *this);
   }
+  if (ioStatOrErrno != IostatOk && msg) {
+    SignalError(ioStatOrErrno, "%.*s", static_cast<int>(length), msg);
+  } else {
+    SignalError(ioStatOrErrno);
+  }
 }
 
 void IoErrorHandler::SignalErrno() { SignalError(errno); }
Index: flang/runtime/io-api.cpp
===================================================================
--- flang/runtime/io-api.cpp
+++ flang/runtime/io-api.cpp
@@ -215,7 +215,7 @@
                                         : "formatted input",
                false, DIR)
         ? &child->BeginIoStatement<ChildFormattedIoStatementState<DIR>>(
-              *child, sourceFile, sourceLine)
+              *child, format, formatLength, sourceFile, sourceLine)
         : nullptr;
   } else {
     IoErrorHandler handler{terminator};
Index: flang/runtime/format-implementation.h
===================================================================
--- flang/runtime/format-implementation.h
+++ flang/runtime/format-implementation.h
@@ -353,7 +353,7 @@
       ++offset_;
     }
   } else if (edit.descriptor == 'D' && Capitalize(PeekNext()) == 'T') {
-    // DT'iotype'(v_list) user-defined derived type I/O
+    // DT['iotype'][(v_list)] user-defined derived type I/O
     edit.descriptor = DataEdit::DefinedDerivedType;
     ++offset_;
     if (auto quote{static_cast<char>(PeekNext())};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117903.402223.patch
Type: text/x-patch
Size: 1800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220122/1b800638/attachment-0001.bin>


More information about the flang-commits mailing list