diff --git a/flang/docs/Extensions.md b/flang/docs/Extensions.md --- a/flang/docs/Extensions.md +++ b/flang/docs/Extensions.md @@ -261,6 +261,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 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 @@ -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(); diff --git a/flang/test/Parser/bad-label.f b/flang/test/Parser/bad-label.f new file mode 100644 --- /dev/null +++ b/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