[flang-commits] [flang] 09b1a6d - [flang] Correct a typo when parsing format token white space

V Donaldson via flang-commits flang-commits at lists.llvm.org
Wed Mar 30 18:56:14 PDT 2022


Author: V Donaldson
Date: 2022-03-30T18:56:09-07:00
New Revision: 09b1a6d6733de9fe876860216898c7fd8b8cfed0

URL: https://github.com/llvm/llvm-project/commit/09b1a6d6733de9fe876860216898c7fd8b8cfed0
DIFF: https://github.com/llvm/llvm-project/commit/09b1a6d6733de9fe876860216898c7fd8b8cfed0.diff

LOG: [flang] Correct a typo when parsing format token white space

A format such as "( D   C, X6. 2  )" is parsed the same as "(DC,X6.2)".

Added: 
    

Modified: 
    flang/include/flang/Common/format.h
    flang/test/Semantics/io07.f90

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Common/format.h b/flang/include/flang/Common/format.h
index 9ba76e919b7fd..ad60cc3d3d9a0 100644
--- a/flang/include/flang/Common/format.h
+++ b/flang/include/flang/Common/format.h
@@ -172,7 +172,7 @@ template <typename CHAR> CHAR FormatValidator<CHAR>::NextChar() {
 
 template <typename CHAR> CHAR FormatValidator<CHAR>::LookAheadChar() {
   for (laCursor_ = cursor_ + 1; laCursor_ < end_; ++laCursor_) {
-    if (!IsWhite(*cursor_)) {
+    if (!IsWhite(*laCursor_)) {
       return toupper(*laCursor_);
     }
   }

diff  --git a/flang/test/Semantics/io07.f90 b/flang/test/Semantics/io07.f90
index 9b1f048e5b17c..1c13c7df20a31 100644
--- a/flang/test/Semantics/io07.f90
+++ b/flang/test/Semantics/io07.f90
@@ -5,8 +5,8 @@
      format(A)
 
 2001 format(3I8, 3Z8)
-2002 format(3I8, Z8)
-2003 format(  3  I  8  ,  3  Z  8  )
+2002 format(DC, F8.2, 3I8, Z8)
+2003 format(  D C , F 8 . 2 , 3  I  8  ,  3  Z  8  )
 2004 format(20PF10.2)
 2005 format(20P,F10.2)
 2006 format(20P7F10.2)


        


More information about the flang-commits mailing list