From 65277494f04da7c4fd5903138d057c0faac7ba9a Mon Sep 17 00:00:00 2001 From: Peter Klausler Date: Thu, 16 Feb 2023 10:46:50 -0800 Subject: [PATCH] [flang][runtime] Allow record advancement in child I/O via '/' control edit descriptor My earlier misreading of the Fortran standards had convinced me that child I/O -- meaning the use of user-defined subroutines via generic interfaces to implement data transfer statements -- was not allowed to advance the current record in the ultimate unit of the original (non-child parent) data transfer statement. This turns out to be wrong, so forward AdvanceRecord() from ChildFormattedIoStatement<> to its parent I/O statement rather than implementing it as a no-op. Differential Revision: https://reviews.llvm.org/D144205 --- flang/runtime/io-stmt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flang/runtime/io-stmt.cpp b/flang/runtime/io-stmt.cpp index c7e349a..8e75ca5 100644 --- a/flang/runtime/io-stmt.cpp +++ b/flang/runtime/io-stmt.cpp @@ -879,8 +879,8 @@ int ChildFormattedIoStatementState::EndIoStatement() { } template -bool ChildFormattedIoStatementState::AdvanceRecord(int) { - return false; // no can do in a child I/O +bool ChildFormattedIoStatementState::AdvanceRecord(int n) { + return this->child().parent().AdvanceRecord(n); } template -- 2.7.4