[flang][runtime] Signal record read overrun when PAD='NO'

When PAD='NO' and ADVANCE='YES', we currently signal an input
error when a formatted read tries to go past the end of a record
only when a fixed RECL= is in effect.  Other compilers will signal
an error without RECL= too, and that seems like a precedent we
should follow.

Differential Revision: https://reviews.llvm.org/D124301
This commit is contained in:
Peter Klausler 2022-04-19 16:48:42 -07:00
parent c02abb68cd
commit aac6e25f7d

View file

@ -674,7 +674,7 @@ bool IoStatementState::CheckForEndOfRecord() {
IoErrorHandler &handler{GetIoErrorHandler()};
if (mutableModes().nonAdvancing) {
handler.SignalEor();
} else if (connection.openRecl && !connection.modes.pad) {
} else if (!connection.modes.pad) {
handler.SignalError(IostatRecordReadOverrun);
}
return connection.modes.pad; // PAD='YES'