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

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 14 13:57:25 PDT 2022


klausler created this revision.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

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


https://reviews.llvm.org/D127789

Files:
  flang/runtime/unit.h


Index: flang/runtime/unit.h
===================================================================
--- flang/runtime/unit.h
+++ flang/runtime/unit.h
@@ -97,7 +97,7 @@
   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(); }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127789.436922.patch
Type: text/x-patch
Size: 496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220614/1a3375c0/attachment.bin>


More information about the flang-commits mailing list