diff --git a/flang/lib/Parser/prescan.cpp b/flang/lib/Parser/prescan.cpp --- a/flang/lib/Parser/prescan.cpp +++ b/flang/lib/Parser/prescan.cpp @@ -594,13 +594,18 @@ } preventHollerith_ = false; } else if (IsLegalInIdentifier(*at_)) { - do { - } while (IsLegalInIdentifier(EmitCharAndAdvance(tokens, *at_))); + while (IsLegalInIdentifier(EmitCharAndAdvance(tokens, *at_))) { + } + if (InFixedFormSource()) { + SkipSpaces(); + } if ((*at_ == '\'' || *at_ == '"') && tokens.CharAt(tokens.SizeInChars() - 1) == '_') { // kind_"..." QuotedCharacterLiteral(tokens, start); + preventHollerith_ = false; + } else { + preventHollerith_ = true; // DO 10 H = ... } - preventHollerith_ = false; } else if (*at_ == '*') { if (EmitCharAndAdvance(tokens, '*') == '*') { EmitCharAndAdvance(tokens, '*'); diff --git a/flang/test/Parser/do100h.f b/flang/test/Parser/do100h.f new file mode 100644 --- /dev/null +++ b/flang/test/Parser/do100h.f @@ -0,0 +1,7 @@ +! RUN: %flang_fc1 -E %s | FileCheck %s +! Test that Hollerith is not mistakenly tokenized here +!CHECK: do 100 h=1,10 + do 100 h=1,10 +100 continue + end +