[flang] Emit portability warning for extension

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.

Differential Revision: https://reviews.llvm.org/D143817
This commit is contained in:
Peter Klausler
2023-02-05 17:25:28 -08:00
parent 8e628f72b0
commit 7c84f6a43a
3 changed files with 11 additions and 0 deletions

View File

@@ -261,6 +261,7 @@ end
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

View File

@@ -629,6 +629,12 @@ bool Prescanner::NextToken(TokenSequence &tokens) {
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();

View File

@@ -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