[PATCH] D117818: [flang] Allow explicit '+' in NAMELIST input subscripts

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 20 17:01:26 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG922c29ccf143: [flang] Allow explicit '+' in NAMELIST input subscripts (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117818/new/

https://reviews.llvm.org/D117818

Files:
  flang/runtime/namelist.cpp
  flang/unittests/Runtime/Namelist.cpp


Index: flang/unittests/Runtime/Namelist.cpp
===================================================================
--- flang/unittests/Runtime/Namelist.cpp
+++ flang/unittests/Runtime/Namelist.cpp
@@ -135,7 +135,7 @@
   aDesc->GetDimension(1).SetBounds(-1, 1);
   const NamelistGroup::Item items[]{{"a", *aDesc}};
   const NamelistGroup group{"justa", 1, items};
-  static char t1[]{"&justa A(0,1:-1:-2)=1 2/"};
+  static char t1[]{"&justa A(0,+1:-1:-2)=1 2/"};
   StaticDescriptor<1, true> statDesc;
   Descriptor &internalDesc{statDesc.descriptor()};
   internalDesc.Establish(TypeCode{CFI_type_char},
@@ -223,7 +223,7 @@
           std::vector<std::string>{"abcdefgh", "ijklmnop"}, 8)};
   const NamelistGroup::Item items[]{{"a", *scDesc}};
   const NamelistGroup group{"justa", 1, items};
-  static char t1[]{"&justa A(:)(2:5)='BCDE' 'JKLM'/"};
+  static char t1[]{"&justa A(:)(2:+5)='BCDE' 'JKLM'/"};
   StaticDescriptor<1, true> statDesc;
   Descriptor &internalDesc{statDesc.descriptor()};
   internalDesc.Establish(TypeCode{CFI_type_char},
Index: flang/runtime/namelist.cpp
===================================================================
--- flang/runtime/namelist.cpp
+++ flang/runtime/namelist.cpp
@@ -99,7 +99,7 @@
   std::optional<SubscriptValue> value;
   std::optional<char32_t> ch{io.GetCurrentChar()};
   bool negate{ch && *ch == '-'};
-  if (negate) {
+  if ((ch && *ch == '+') || negate) {
     io.HandleRelativePosition(1);
     ch = io.GetCurrentChar();
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117818.401818.patch
Type: text/x-patch
Size: 1480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220121/4a7252d5/attachment.bin>


More information about the llvm-commits mailing list