[flang] Add missing call to BeginReadingRecord()
authorpeter klausler <pklausler@nvidia.com>
Fri, 13 Aug 2021 18:57:58 +0000 (11:57 -0700)
committerpeter klausler <pklausler@nvidia.com>
Tue, 17 Aug 2021 18:10:25 +0000 (11:10 -0700)
NAMELIST input needs to start with a call to BeginReadingRecord().
Internal unit input doesn't care (so unit tests were passing), but
external unit input does need the call and will assert without it.

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

flang/runtime/namelist.cpp

index 7ca8d5c..4aee148 100644 (file)
@@ -263,6 +263,7 @@ bool IONAME(InputNamelist)(Cookie cookie, const NamelistGroup &group) {
   auto *listInput{io.get_if<ListDirectedStatementState<Direction::Input>>()};
   RUNTIME_CHECK(handler, listInput != nullptr);
   // Check the group header
+  io.BeginReadingRecord();
   std::optional<char32_t> next{io.GetNextNonBlank()};
   if (!next || *next != '&') {
     handler.SignalError(