[flang-commits] [PATCH] D143817: [flang] Emit portability warning for extension
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Sat Feb 11 09:36:49 PST 2023
klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added subscribers: sunshaoce, jdoerfert.
Herald added a reviewer: sscalpone.
Herald added a project: All.
klausler requested review of this revision.
f18 accepts statement labels in fixed form source even if they follow
a semicolon -- i.e., they're not in the fixed form's label field.
Emit a warning for such usage.
https://reviews.llvm.org/D143817
Files:
flang/docs/Extensions.md
flang/lib/Parser/prescan.cpp
flang/test/Parser/bad-label.f
Index: flang/test/Parser/bad-label.f
===================================================================
--- /dev/null
+++ flang/test/Parser/bad-label.f
@@ -0,0 +1,4 @@
+! RUN: %flang_fc1 -fsyntax-only -pedantic %s 2>&1 | FileCheck %s
+!CHECK: portability: Label should be in the label field
+ goto 1; 1 continue
+ end
Index: flang/lib/Parser/prescan.cpp
===================================================================
--- flang/lib/Parser/prescan.cpp
+++ flang/lib/Parser/prescan.cpp
@@ -629,6 +629,12 @@
EmitCharAndAdvance(tokens, nch);
} else if (ch == '/') {
slashInCurrentStatement_ = true;
+ } else if (ch == ';' && InFixedFormSource()) {
+ SkipSpaces();
+ if (IsDecimalDigit(*at_)) {
+ Say(GetProvenanceRange(at_, at_ + 1),
+ "Label should be in the label field"_port_en_US);
+ }
}
}
tokens.CloseToken();
Index: flang/docs/Extensions.md
===================================================================
--- flang/docs/Extensions.md
+++ flang/docs/Extensions.md
@@ -256,6 +256,7 @@
to apply only to a scalar data-ref, but most compilers don't
enforce it and the constraint is not necessary for a correct
implementation.
+* A label may follow a semicolon in fixed form source.
### Extensions supported when enabled by options
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143817.496693.patch
Type: text/x-patch
Size: 1328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230211/4f7ee0ed/attachment-0001.bin>
More information about the flang-commits
mailing list