Skip to content

Commit 1650fb8

Browse files
committed
[flang][runtime] Respect PAD='NO' on READ/WRITE
The check for the PAD= setting should examine the mutable modes of the current I/O statement, not the persistent modes of the I/O unit. Differential Revision: https://reviews.llvm.org/D128389
1 parent bc07634 commit 1650fb8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

flang/runtime/io-stmt.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,8 @@ bool IoStatementState::CheckForEndOfRecord() {
677677
if (auto length{connection.EffectiveRecordLength()}) {
678678
if (connection.positionInRecord >= *length) {
679679
IoErrorHandler &handler{GetIoErrorHandler()};
680-
if (mutableModes().nonAdvancing) {
680+
const auto &modes{mutableModes()};
681+
if (modes.nonAdvancing) {
681682
if (connection.access == Access::Stream &&
682683
connection.unterminatedRecord) {
683684
// Reading final unterminated record left by a
@@ -687,10 +688,10 @@ bool IoStatementState::CheckForEndOfRecord() {
687688
} else {
688689
handler.SignalEor();
689690
}
690-
} else if (!connection.modes.pad) {
691+
} else if (!modes.pad) {
691692
handler.SignalError(IostatRecordReadOverrun);
692693
}
693-
return connection.modes.pad; // PAD='YES'
694+
return modes.pad; // PAD='YES'
694695
}
695696
}
696697
}

0 commit comments

Comments
 (0)