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

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Thu Aug 18 14:51:20 PDT 2022


Author: Peter Klausler
Date: 2022-08-18T14:51:04-07:00
New Revision: fde42ac5b9d467debd37a57dc941734678cc18c3

URL: https://github.com/llvm/llvm-project/commit/fde42ac5b9d467debd37a57dc941734678cc18c3
DIFF: https://github.com/llvm/llvm-project/commit/fde42ac5b9d467debd37a57dc941734678cc18c3.diff

LOG: [flang][runtime] Don't raise internal error in user error recovery situation

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.

Differential Revision: https://reviews.llvm.org/D132160

Added: 
    

Modified: 
    flang/runtime/io-stmt.h

Removed: 
    


################################################################################
diff  --git a/flang/runtime/io-stmt.h b/flang/runtime/io-stmt.h
index 0482a13d47f7..46fc2157fbb5 100644
--- a/flang/runtime/io-stmt.h
+++ b/flang/runtime/io-stmt.h
@@ -189,10 +189,10 @@ class IoStatementState {
     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;
     }


        


More information about the flang-commits mailing list