[flang][runtime] Fix INQUIRE(POS=n) for non-advancing I/O

Position inquiries need to account for offsets in records to be
accurate in the case of non-advancing I/O.

Differential Revision: https://reviews.llvm.org/D127789
This commit is contained in:
Peter Klausler 2022-06-11 06:34:58 -07:00
parent 8ef1075381
commit f6253eb9ba
1 changed files with 1 additions and 1 deletions

View File

@ -96,7 +96,7 @@ public:
void SetPosition(std::int64_t, IoErrorHandler &); // zero-based
std::int64_t InquirePos() const {
// 12.6.2.11 defines POS=1 as the beginning of file
return frameOffsetInFile_ + 1;
return frameOffsetInFile_ + recordOffsetInFrame_ + positionInRecord + 1;
}
ChildIo *GetChildIo() { return child_.get(); }