public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42852]  New: gfortran -Wall warns about truncated lines when only a continuation character is truncated
@ 2010-01-23 20:03 bugs at 59A2 dot org
  2010-01-23 21:29 ` [Bug fortran/42852] " kargl at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: bugs at 59A2 dot org @ 2010-01-23 20:03 UTC (permalink / raw)
  To: gcc-bugs

gfortran -Wall currently warns about truncated lines even when character 73 is
an ampersand.  Observe item (4) of Note 3.10 in the Fortran 2003 standard:


In some circumstances, for example where source code is maintained in an
INCLUDE file for use in programs whose source form might be either
fixed or free, observing the following rules allows the code to be used
with either source form:

(1) Confine statement labels to character positions 1 to 5 and statements
to character positions 7 to 72;

(2) Treat blanks as being significant;

(3) Use only the exclamation mark (!) to indicate a comment, but do not start
the comment in character position 6;

(4) For continued statements, place an ampersand (&) in both character position
73 of a continued line and character position 6 of a continuing line.


-- 
           Summary: gfortran -Wall warns about truncated lines when only a
                    continuation character is truncated
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bugs at 59A2 dot org
 GCC build triplet: gcc-4.5-20100121


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
@ 2010-01-23 21:29 ` kargl at gcc dot gnu dot org
  2010-01-23 21:54 ` bugs at 59A2 dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-01-23 21:29 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
  2010-01-23 21:29 ` [Bug fortran/42852] " kargl at gcc dot gnu dot org
@ 2010-01-23 21:54 ` bugs at 59A2 dot org
  2010-01-24  0:57 ` kargl at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bugs at 59A2 dot org @ 2010-01-23 21:54 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
  2010-01-23 21:29 ` [Bug fortran/42852] " kargl at gcc dot gnu dot org
  2010-01-23 21:54 ` bugs at 59A2 dot org
@ 2010-01-24  0:57 ` kargl at gcc dot gnu dot org
  2010-01-25 10:33 ` bugs at 59A2 dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-01-24  0:57 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
                   ` (2 preceding siblings ...)
  2010-01-24  0:57 ` kargl at gcc dot gnu dot org
@ 2010-01-25 10:33 ` bugs at 59A2 dot org
  2010-03-01  6:30 ` jvdelisle at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bugs at 59A2 dot org @ 2010-01-25 10:33 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
                   ` (3 preceding siblings ...)
  2010-01-25 10:33 ` bugs at 59A2 dot org
@ 2010-03-01  6:30 ` jvdelisle at gcc dot gnu dot org
  2010-03-01  7:32 ` burnus at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-03-01  6:30 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
                   ` (4 preceding siblings ...)
  2010-03-01  6:30 ` jvdelisle at gcc dot gnu dot org
@ 2010-03-01  7:32 ` burnus at gcc dot gnu dot org
  2010-03-01 14:28 ` jvdelisle at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-03-01  7:32 UTC (permalink / raw)
  To: gcc-bugs



------- 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 ' <many, many spaces> // 'world'
even though only "Hello" is printed. That is a 4.5 regression.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
                   ` (5 preceding siblings ...)
  2010-03-01  7:32 ` burnus at gcc dot gnu dot org
@ 2010-03-01 14:28 ` jvdelisle at gcc dot gnu dot org
  2010-07-25 15:08 ` jvdelisle at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-03-01 14:28 UTC (permalink / raw)
  To: gcc-bugs



------- 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|0000-00-00 00:00:00         |2010-03-01 14:27:50
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42852


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
                   ` (6 preceding siblings ...)
  2010-03-01 14:28 ` jvdelisle at gcc dot gnu dot org
@ 2010-07-25 15:08 ` jvdelisle at gcc dot gnu dot org
  2010-07-25 15:35 ` jvdelisle at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-07-25 15:08 UTC (permalink / raw)
  To: gcc-bugs



------- 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  <jvdelisle@gcc.gnu.org>

        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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
                   ` (7 preceding siblings ...)
  2010-07-25 15:08 ` jvdelisle at gcc dot gnu dot org
@ 2010-07-25 15:35 ` jvdelisle at gcc dot gnu dot org
  2010-07-25 15:38 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-07-25 15:35 UTC (permalink / raw)
  To: gcc-bugs



------- 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  <jvdelisle@gcc.gnu.org>

        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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
                   ` (8 preceding siblings ...)
  2010-07-25 15:35 ` jvdelisle at gcc dot gnu dot org
@ 2010-07-25 15:38 ` jvdelisle at gcc dot gnu dot org
  2010-07-25 16:23 ` bugs at 59A2 dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-07-25 15:38 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
                   ` (9 preceding siblings ...)
  2010-07-25 15:38 ` jvdelisle at gcc dot gnu dot org
@ 2010-07-25 16:23 ` bugs at 59A2 dot org
  2010-07-25 17:02 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bugs at 59A2 dot org @ 2010-07-25 16:23 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
                   ` (10 preceding siblings ...)
  2010-07-25 16:23 ` bugs at 59A2 dot org
@ 2010-07-25 17:02 ` jvdelisle at gcc dot gnu dot org
  2010-07-25 19:10 ` jvdelisle at gcc dot gnu dot org
  2010-07-25 19:23 ` bugs at 59A2 dot org
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-07-25 17:02 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
                   ` (11 preceding siblings ...)
  2010-07-25 17:02 ` jvdelisle at gcc dot gnu dot org
@ 2010-07-25 19:10 ` jvdelisle at gcc dot gnu dot org
  2010-07-25 19:23 ` bugs at 59A2 dot org
  13 siblings, 0 replies; 15+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-07-25 19:10 UTC (permalink / raw)
  To: gcc-bugs



------- 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  <jvdelisle@gcc.gnu.org>

        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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug fortran/42852] gfortran -Wall warns about truncated lines when only a continuation character is truncated
  2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
                   ` (12 preceding siblings ...)
  2010-07-25 19:10 ` jvdelisle at gcc dot gnu dot org
@ 2010-07-25 19:23 ` bugs at 59A2 dot org
  13 siblings, 0 replies; 15+ messages in thread
From: bugs at 59A2 dot org @ 2010-07-25 19:23 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-07-25 19:23 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-23 20:03 [Bug fortran/42852] New: gfortran -Wall warns about truncated lines when only a continuation character is truncated bugs at 59A2 dot org
2010-01-23 21:29 ` [Bug fortran/42852] " kargl at gcc dot gnu dot org
2010-01-23 21:54 ` bugs at 59A2 dot org
2010-01-24  0:57 ` kargl at gcc dot gnu dot org
2010-01-25 10:33 ` bugs at 59A2 dot org
2010-03-01  6:30 ` jvdelisle at gcc dot gnu dot org
2010-03-01  7:32 ` burnus at gcc dot gnu dot org
2010-03-01 14:28 ` jvdelisle at gcc dot gnu dot org
2010-07-25 15:08 ` jvdelisle at gcc dot gnu dot org
2010-07-25 15:35 ` jvdelisle at gcc dot gnu dot org
2010-07-25 15:38 ` jvdelisle at gcc dot gnu dot org
2010-07-25 16:23 ` bugs at 59A2 dot org
2010-07-25 17:02 ` jvdelisle at gcc dot gnu dot org
2010-07-25 19:10 ` jvdelisle at gcc dot gnu dot org
2010-07-25 19:23 ` bugs at 59A2 dot 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).