mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-26 19:36:28 +00:00
[flang][runtime] BACKSPACE after non-advancing I/O
A BACKSPACE statement on a unit after a READ or WRITE with ADVANCE="NO" must reset the position to the beginning of the record, not to the beginning of the previous one. Differential Revision: https://reviews.llvm.org/D125057
This commit is contained in:
parent
28b5e99a4c
commit
72831a592e
@ -315,6 +315,9 @@ void ExternalIoStatementState<DIR>::CompleteOperation() {
|
||||
}
|
||||
if constexpr (DIR == Direction::Input) {
|
||||
BeginReadingRecord(); // in case there were no I/O items
|
||||
if (mutableModes().nonAdvancing) {
|
||||
unit().leftTabLimit = unit().furthestPositionInRecord;
|
||||
}
|
||||
if (!mutableModes().nonAdvancing || GetIoStat() == IostatEor) {
|
||||
FinishReadingRecord();
|
||||
}
|
||||
|
@ -569,6 +569,9 @@ void ExternalFileUnit::BackspaceRecord(IoErrorHandler &handler) {
|
||||
if (IsAfterEndfile()) {
|
||||
// BACKSPACE after explicit ENDFILE
|
||||
currentRecordNumber = *endfileRecordNumber;
|
||||
} else if (leftTabLimit) {
|
||||
// BACKSPACE after non-advancing I/O
|
||||
leftTabLimit.reset();
|
||||
} else {
|
||||
DoImpliedEndfile(handler);
|
||||
if (frameOffsetInFile_ + recordOffsetInFrame_ > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user