[flang-commits] [PATCH] D122036: [flang] Error recovery improvement in runtime (IOMSG=)

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Mar 18 13:45:05 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.

Some refactoring and related fixes for more accurate
user program error recovery in the I/O runtime, especially
for error recovery with IOMSG= character values.

1. Move any work in an EndIoStatement() implementation

that may raise an error into a new CompleteOperation()
member function.  This allows error handling APIs like
GetIoMsg() to complete a pending I/O statement and harvest
any errors that may result.

2. Move the pending error code from ErroneousIoStatementState

to a new pendingError_ data member in IoErrorHandler.
This allows IoErrorHandler::InError() to return a correct
result when there is a pending error that will be recovered
from so that I/O list data transfers don't crash in the meantime.

3. Don't create and leak a unit for a failed OPEN(NEWUNIT=n)

with error recovery, and don't modify 'n'.  (Depends on
changes to API call ordering in lowering, in a separate patch;
code was added to ensure that OPEN statement control list
specifiers, e.g. SetFile(), must be passed before GetNewUnit().)

4. Fix the code that calls a form of strerror to fill an

IOMSG= variable so that it actually works for Fortran's
character type: blank fill with no null or newline termination.


https://reviews.llvm.org/D122036

Files:
  flang/runtime/descriptor-io.h
  flang/runtime/io-api.cpp
  flang/runtime/io-error.cpp
  flang/runtime/io-error.h
  flang/runtime/io-stmt.cpp
  flang/runtime/io-stmt.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122036.416599.patch
Type: text/x-patch
Size: 24346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220318/3095e3a4/attachment-0001.bin>


More information about the flang-commits mailing list