[flang-commits] [PATCH] D150406: [flang] Don't mistakenly tokenize a Hollerith literal from "DO 100 H=..." (bug #58732)
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Tue May 16 09:56:49 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa6569e578eb4: [flang] Don't mistakenly tokenize a Hollerith literal from "DO 100 H=..." (bug… (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150406/new/
https://reviews.llvm.org/D150406
Files:
flang/lib/Parser/prescan.cpp
flang/test/Parser/do100h.f
Index: flang/test/Parser/do100h.f
===================================================================
--- /dev/null
+++ 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
+
Index: flang/lib/Parser/prescan.cpp
===================================================================
--- flang/lib/Parser/prescan.cpp
+++ 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, '*');
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150406.522676.patch
Type: text/x-patch
Size: 1240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230516/67214fef/attachment.bin>
More information about the flang-commits
mailing list