Index: flang/include/flang/Common/format.h =================================================================== --- flang/include/flang/Common/format.h +++ flang/include/flang/Common/format.h @@ -172,24 +172,24 @@ template CHAR FormatValidator::LookAheadChar() { for (laCursor_ = cursor_ + 1; laCursor_ < end_; ++laCursor_) { - if (!IsWhite(*cursor_)) { + if (!IsWhite(*laCursor_)) { return toupper(*laCursor_); } } laCursor_ = end_; // don't allow laCursor_ > end_ return ' '; } // After a call to LookAheadChar, set token kind and advance cursor to laCursor. template void FormatValidator::Advance(TokenKind tk) { cursor_ = laCursor_; token_.set_kind(tk); } template void FormatValidator::NextToken() { // At entry, cursor_ points before the start of the next token. // At exit, cursor_ points to last CHAR of token_. previousTokenKind_ = token_.kind(); CHAR c{NextChar()}; token_.set_kind(TokenKind::None); Index: flang/test/Semantics/io07.f90 =================================================================== --- flang/test/Semantics/io07.f90 +++ 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)