[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #1 from kargl at gcc dot gnu dot org 2010-01-23 21:29 --- I changed this to a P5 and enhancement request; although I much more inclined to close this with a WONTFIX. Notes in the Standard are non-normative text. It's clear that there is an assumption in this Note that a Fortran processor simply ignores any characters beyond column 72. That is not a requirement the Standard places on a processor. The Fortran places a restriction on the programmer that fixed form code is a maximum 72 column long In other words, fix your code by putting an & in column 72. -- kargl at gcc dot gnu dot org changed: What|Removed |Added Severity|normal |enhancement Priority|P3 |P5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #2 from bugs at 59A2 dot org 2010-01-23 21:54 --- > In other words, fix your code by putting an & in column 72. This is not a solution since it makes it invalid fixed-form source: Error: Syntax error in argument list at (1) Not treating the char-73 & specially makes -Wline-truncation useless in projects containing source that is intended to be both fixed and free-form. I realize the note is not normative, and the spec states "If a source line contains only default kind characters, it shall contain exactly 72 characters; otherwise, its maximum number of characters is processor dependent". However, there are many people formatting code according to note 4.10, especially header code provided by libraries. Choosing fixed or free-form forces a convention on users, and this is really unacceptable. So, in lieu of gfortran addressing this ticket, the only way for a library to not break its users' ability to use -Wline-truncation would be to generate two versions of the header, but this is work to maintain and requires users to update all include statements. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #3 from kargl at gcc dot gnu dot org 2010-01-24 00:57 --- (In reply to comment #2) > > In other words, fix your code by putting an & in column 72. > > This is not a solution since it makes it invalid fixed-form source: > > Error: Syntax error in argument list at (1) Yes, I realized my mistake after I posted. > Not treating the char-73 & specially makes -Wline-truncation useless in > projects containing source that is intended to be both fixed and free-form. I > realize the note is not normative, and the spec states "If a source line > contains only default kind characters, it shall contain exactly 72 characters; > otherwise, its maximum number of characters is processor dependent". However, > there are many people formatting code according to note 4.10, especially > header > code provided by libraries. What? This is the first bug report about this problem I've seen in my 7 years of hacking on gfortran. I doubt that there are "many people" formatting their code according to a Note in the Standard. Most people don't even have a copy of the Standard. > Choosing fixed or free-form forces a convention on > users, and this is really unacceptable. gfortran supports both fixed and free form. Choose whatever form you want. If you choose to mix the two, then you need to deal with processor-dependent behavior. > So, in lieu of gfortran addressing > this ticket, the only way for a library to not break its users' ability to use > -Wline-truncation would be to generate two versions of the header, but this is > work to maintain and requires users to update all include statements. So it's gfortran's fault you write non-portable code, and instead of dealing with it on your end, you think that gfortran developers should do the work to make your code compile. I'll note that I stated that I felt it should be closed with a WONTFIX, but changed it to an enhancement request. In lieu of receiving a patch from you to address the issue, someone may someday in the distant future, when there are less important bugs to fix, might address the issue. The Note in the Standard is assuming a specific behavior for a processor-dependent behavior. gfortran currently does not assume that specific choice. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #4 from bugs at 59A2 dot org 2010-01-25 10:33 --- (In reply to comment #3) > So it's gfortran's fault you write non-portable code, and instead > of dealing with it on your end, you think that gfortran developers > should do the work to make your code compile. Actually, gfortran versions up to and including 4.4.2 do not complain about this usage (but it looks like that was due to -Wline-truncation being defective). All versions of gfortran compile this hybrid source "correctly", it's only (what I consider) a spurious warning with -Wline-truncation, and only in the 4.5 snapshot. > I'll note that I stated that I felt it should be closed with a > WONTFIX, but changed it to an enhancement request. In lieu of receiving > a patch from you to address the issue, someone may someday in the > distant future, when there are less important bugs to fix, might > address the issue. I'm not familiar with the project, but if you tell me where to look, I may be able to submit a patch. > The Note in the Standard is assuming a specific behavior for a > processor-dependent behavior. gfortran currently does not > assume that specific choice. Based on the way the source is compiled, as opposed to warnings under -Wline-truncation, gfortran *does* make that specific choice. If you are saying that this may change in the future (making such source an error instead of a warning), then the warning is completely valid (but anticipate user complaints if such a change happens). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #5 from jvdelisle at gcc dot gnu dot org 2010-03-01 06:30 --- Created an attachment (id=19993) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19993&action=view) A suggested patch This patch does the trick. I think it is sensible to not warn on leading spaces, a comment, or continuation &. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #6 from burnus at gcc dot gnu dot org 2010-03-01 07:31 --- (In reply to comment #5) > Created an attachment (id=19993) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19993&action=view) [edit] > A suggested patch > > This patch does the trick. I think it is sensible to not warn on leading > spaces, a comment, or continuation &. I agree, however, I would expect still a warning for something & dhjgjl where "&" is e.g. in column 73. * * * Something related: In free format, there is no trunction warning for print *, 'Hello ' // 'world' even though only "Hello" is printed. That is a 4.5 regression. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #7 from jvdelisle at gcc dot gnu dot org 2010-03-01 14:27 --- OK, I will make some adjustments. -- jvdelisle at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |jvdelisle at gcc dot gnu dot |dot org |org Status|UNCONFIRMED |ASSIGNED Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2010-03-01 14:27:50 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #8 from jvdelisle at gcc dot gnu dot org 2010-07-25 15:08 --- Subject: Bug 42852 Author: jvdelisle Date: Sun Jul 25 15:07:45 2010 New Revision: 162512 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162512 Log: 2010-07-25 Jerry DeLisle PR fortran/42852 * scanner.c (gfc_next_char_literal): Move check for truncation earlier in the function so that it does not get missed by early exits. (load_line): Add checks for quoted strings and free form comments to disable warnings on comments. Add check for ampersand as first character after truncation and don't warn for this case, but warn if there are subsequent non-whitespace characters. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/scanner.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #9 from jvdelisle at gcc dot gnu dot org 2010-07-25 15:35 --- Subject: Bug 42852 Author: jvdelisle Date: Sun Jul 25 15:35:04 2010 New Revision: 162514 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162514 Log: 2010-07-25 Jerry DeLisle PR fortran/42852 * gfortran.dg/wtruncate_fix.f: New test. Added: trunk/gcc/testsuite/gfortran.dg/wtruncate_fix.f Modified: trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #10 from jvdelisle at gcc dot gnu dot org 2010-07-25 15:38 --- Closing as fixed. -- jvdelisle at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #11 from bugs at 59A2 dot org 2010-07-25 16:23 --- Will this be applied to 4.5.1? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #12 from jvdelisle at gcc dot gnu dot org 2010-07-25 17:02 --- I doubt I would be allowed since 4.5.1 is at release candidate 1 phase. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #13 from jvdelisle at gcc dot gnu dot org 2010-07-25 19:10 --- Subject: Bug 42852 Author: jvdelisle Date: Sun Jul 25 19:10:09 2010 New Revision: 162518 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162518 Log: 2010-07-25 Jerry DeLisle PR fortran/42852 * scanner.c (gfc_next_char_literal): Enable truncation warning for free-form '&'. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/scanner.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852
[Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
--- Comment #14 from bugs at 59A2 dot org 2010-07-25 19:23 --- Okay, thanks for the fix. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852