[llvm] [flang][runtime] tweak advancing for child list directed io (PR #156753)

Andre Kuhlenschmidt via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 3 13:48:57 PDT 2025


https://github.com/akuhlens created https://github.com/llvm/llvm-project/pull/156753

Updates the runtime to allow record to advance whenever a child IO statement is trying to read past the end of a record.

Fixes: https://github.com/llvm/llvm-project/issues/154979

Doesn't help with: https://github.com/llvm/llvm-project/issues/154979 

I am adding a test to the llvm-test-suite to demonstrate this behavior and allow us to test other similar issues.

>From 78547871c3a7a9abde35a23c9406cec7d11f5552 Mon Sep 17 00:00:00 2001
From: Andre Kuhlenschmidt <akuhlenschmi at nvidia.com>
Date: Wed, 3 Sep 2025 12:53:00 -0700
Subject: [PATCH] initial commit

---
 flang-rt/lib/runtime/io-stmt.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang-rt/lib/runtime/io-stmt.cpp b/flang-rt/lib/runtime/io-stmt.cpp
index 3260c8f83edb9..be641f6d2a531 100644
--- a/flang-rt/lib/runtime/io-stmt.cpp
+++ b/flang-rt/lib/runtime/io-stmt.cpp
@@ -1109,7 +1109,7 @@ template <Direction DIR>
 bool ChildListIoStatementState<DIR>::AdvanceRecord(int n) {
 #if !defined(RT_DEVICE_AVOID_RECURSION)
   // Allow child NAMELIST input to advance
-  if (DIR == Direction::Input && this->mutableModes().inNamelist) {
+  if constexpr (DIR == Direction::Input) {
     return this->child().parent().AdvanceRecord(n);
   } else {
     return false;



More information about the llvm-commits mailing list