Is there a way to "terminate" an in-progress WRITE operation to a device? As noted in the summary, I have a program which is generating an array bounds error (#408) when building output for a WRITE statement. The RTL dutifully calls my error handler that I've registered with ESTABLISHQQ with the subscript array bounds message. My error handler does its thing (begins an orderly shutdown, never returning to the calling function), but as part of that shutdown it wants to print out the error message returned to it from the RTL. Unfortunately, since it looks as though the RTL doesn't "flush" (or complete? terminate?) the WRITE statement prior to calling the error handler, I get a recursive I/O operation error (#40) when I try printing the error message to LU #6.
Is there a way I can forcefully "terminate" the hold the faulting WRITE statement has on the I/O device (STDOUT) from my error handler, so I can send the error message text to it? Unfortunately, I appear to have not coded my error handler to deal with this condition gracefully, so when the attempted write to STDOUT generates another RTL exception, it calls the error handler again, which then tries printing to STDOUT again, ad infinitium, until my stack overflows. While I can probably trap this case by immediately unregistering my error handler with the RTL upon entering (or setting a variable state to detect and prevent recursion), I would still prefer to be able to issue the error message to the terminal.
Thanks in advance.
EDIT: Using ifort 15.0.2