[flang][runtime] Fix list-directed/NAMELIST complex input with "r*" repetition count
authorPeter Klausler <pklausler@nvidia.com>
Mon, 6 Jun 2022 21:14:42 +0000 (14:14 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Mon, 13 Jun 2022 17:50:25 +0000 (10:50 -0700)
The little state machine in GetNextDataEdit() wasn't transitioning
properly from reading the imaginary part of the number back to the
real part for the next iteration of a repeated value.

Differential Revision: https://reviews.llvm.org/D127422

flang/runtime/io-stmt.cpp

index a73012dab61690bef2df3f06c81d5152059c46fa..0201ad2bf7dad9db649ec971e068ee9c69341c79 100644 (file)
@@ -799,7 +799,9 @@ ListDirectedStatementState<Direction::Input>::GetNextDataEdit(
     if (remaining_ > 0) {
       repeatPosition_.emplace(io);
     }
-    return edit;
+    if (!imaginaryPart_) {
+      return edit;
+    }
   }
   // Skip separators, handle a "r*c" repeat count; see 13.10.2 in Fortran 2018
   if (imaginaryPart_) {