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) {