[flang-commits] [PATCH] D130430: [flang][runtime] Reset unit frame buffer when re-opening

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Sat Jul 23 11:23:39 PDT 2022


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

An OPEN statement that implies closing a connection must invalidate
the unit's frame buffer so as to prevent stale data from the old
connection from being read into the newly-connected unit.


https://reviews.llvm.org/D130430

Files:
  flang/runtime/unit.cpp


Index: flang/runtime/unit.cpp
===================================================================
--- flang/runtime/unit.cpp
+++ flang/runtime/unit.cpp
@@ -114,6 +114,7 @@
     // Otherwise, OPEN on open unit with new FILE= implies CLOSE
     DoImpliedEndfile(handler);
     FlushOutput(handler);
+    TruncateFrame(0, handler);
     Close(CloseStatus::Keep, handler);
   }
   if (newPath.get() && newPathLength > 0) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130430.447093.patch
Type: text/x-patch
Size: 419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220723/87f983d8/attachment.bin>


More information about the flang-commits mailing list