public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/112586] New: [F2023] Add "A statement shall not have more than one million characters." warning
@ 2023-11-17 11:00 burnus at gcc dot gnu.org
0 siblings, 0 replies; only message in thread
From: burnus at gcc dot gnu.org @ 2023-11-17 11:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112586
Bug ID: 112586
Summary: [F2023] Add "A statement shall not have more than one
million characters." warning
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
See also https://gcc.gnu.org/pipermail/gcc-patches/2023-November/636868.html
GCC currently has a warning for:
if (gfc_notification_std (GFC_STD_GNU) || pedantic)
gfc_warning (0, "Limit of %d continuations exceeded in "
"statement at %C",
for both fixed and free form source code. This matches:
Fortran 2018's
"A statement shall not have more than 255 continuation lines."
But Fortran 2023 now has:
"A statement shall not have more than one million characters."
Where a 'statement' is "A Fortran statement is a sequence of one or more
complete or partial lines." - and a 'line' is: "sequence of zero or more
characters".
It is not completely clear to me in how far comments count; It seems as if
comment lines (blank lines or blanks followed by a comment) do not count - but
do in-line comments count? What about '&'? Does a (partial) line start with
the first non-blank character or already at the first column? It probably ends
with '\n' and ';' and neither counts.
* * *
The parsing is done in scanner.cc's gfc_next_char_literal — as code is
reparsed, i.e. gfc_current_locus can move to older code, we cannot simply
count the number of characters at "return c".
BTW: As scanner.cc currently does not handle ';', which had to be added in that
case.
Actually, it is not quite clear to me how the counting of continuation lines
works with 'gfc_current_locus = old_loc' handling. As long we only jump back in
the same line, it's fine - but I expect that reparsing might cause problems
with the count handling. This count is only used by warning above, but
nonetheless.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-17 11:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-17 11:00 [Bug fortran/112586] New: [F2023] Add "A statement shall not have more than one million characters." warning burnus at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).