[flang-commits] [flang] c7cabf9 - [flang] Define new runtime error IOSTAT values (I/O runtime work part 4)

peter klausler via flang-commits flang-commits at lists.llvm.org
Fri Jul 3 12:42:23 PDT 2020


Author: peter klausler
Date: 2020-07-03T12:41:33-07:00
New Revision: c7cabf9d608b9aad82e9cb684fbbe9f7a76bf4e0

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

LOG: [flang] Define new runtime error IOSTAT values (I/O runtime work part 4)

Add more IOSTAT= values for errors that can arise in external I/O.

Reviewed By: sscalpone

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

Added: 
    

Modified: 
    flang/runtime/iostat.cpp
    flang/runtime/iostat.h

Removed: 
    


################################################################################
diff  --git a/flang/runtime/iostat.cpp b/flang/runtime/iostat.cpp
index c86619d384f9..9fe6d22de85d 100644
--- a/flang/runtime/iostat.cpp
+++ b/flang/runtime/iostat.cpp
@@ -33,6 +33,26 @@ const char *IostatErrorString(int iostat) {
     return "Invalid FORMAT";
   case IostatErrorInKeyword:
     return "Bad keyword argument value";
+  case IostatEndfileNonSequential:
+    return "ENDFILE on non-sequential file";
+  case IostatEndfileUnwritable:
+    return "ENDFILE on read-only file";
+  case IostatOpenBadRecl:
+    return "OPEN with bad RECL= value";
+  case IostatOpenUnknownSize:
+    return "OPEN of file of unknown size";
+  case IostatOpenBadAppend:
+    return "OPEN(POSITION='APPEND') of unpositionable file";
+  case IostatWriteToReadOnly:
+    return "Attempted output to read-only file";
+  case IostatReadFromWriteOnly:
+    return "Attempted input from write-only file";
+  case IostatBackspaceNonSequential:
+    return "BACKSPACE on non-sequential file";
+  case IostatBackspaceAtFirstRecord:
+    return "BACKSPACE at first record";
+  case IostatRewindNonSequential:
+    return "REWIND on non-sequential file";
   default:
     return nullptr;
   }

diff  --git a/flang/runtime/iostat.h b/flang/runtime/iostat.h
index 2ab5ac8232d2..f51636d5f7d0 100644
--- a/flang/runtime/iostat.h
+++ b/flang/runtime/iostat.h
@@ -45,6 +45,16 @@ enum Iostat {
   IostatInternalWriteOverrun,
   IostatErrorInFormat,
   IostatErrorInKeyword,
+  IostatEndfileNonSequential,
+  IostatEndfileUnwritable,
+  IostatOpenBadRecl,
+  IostatOpenUnknownSize,
+  IostatOpenBadAppend,
+  IostatWriteToReadOnly,
+  IostatReadFromWriteOnly,
+  IostatBackspaceNonSequential,
+  IostatBackspaceAtFirstRecord,
+  IostatRewindNonSequential,
 };
 
 const char *IostatErrorString(int);


        


More information about the flang-commits mailing list