[flang-commits] [PATCH] D132160: [flang][runtime] Don't raise internal error in user error recovery situation

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Aug 18 11:21:40 PDT 2022


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

In the case of a data transfer I/O statement with an illegal unit number and
error recovery, ensure that data transfer API calls don't raise internal
errors due to the I/O statement representation unexpectedly being something
other than a data transfer statement.


https://reviews.llvm.org/D132160

Files:
  flang/runtime/io-stmt.h


Index: flang/runtime/io-stmt.h
===================================================================
--- flang/runtime/io-stmt.h
+++ flang/runtime/io-stmt.h
@@ -189,10 +189,10 @@
     if (get_if<FormattedIoStatementState<D>>()) {
       return true;
     } else {
-      if (!get_if<ErroneousIoStatementState>()) {
-        GetIoErrorHandler().Crash(
-            "%s called for I/O statement that is not formatted %s", name,
-            D == Direction::Output ? "output" : "input");
+      auto &handler{GetIoErrorHandler()};
+      if (!handler.InError()) {
+        handler.Crash("%s called for I/O statement that is not formatted %s",
+            name, D == Direction::Output ? "output" : "input");
       }
       return false;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132160.453724.patch
Type: text/x-patch
Size: 740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220818/43e3bc76/attachment.bin>


More information about the flang-commits mailing list