public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/64522] New: [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default
@ 2015-01-07 13:11 burnus at gcc dot gnu.org
  2015-01-08 14:02 ` [Bug fortran/64522] " burnus at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2015-01-07 13:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64522

            Bug ID: 64522
           Summary: [4.8/4.9/5 Regression] Free-form source code:
                    -Wline-truncation is no longer enabled by default
           Product: gcc
           Version: 5.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

Using GCC 4.4, a free-form source code which exceeds the 132 character limit
showed by default the message:
  "Warning: Line truncated at (1)"

Using GCC 4.8, 4.9 and 5, this message is only shown with -Wline-truncation
(which is implied by -Wall).

As other compilers by default use -ffree-line-length-none (unlimited line
length), it makes sense to show this warning by default - or even to error out.
Currently, it may lead to difficult-to-find bugs.


[GCC 4.4 did not show this warning by default for fixed-form source code, which
makes sense]


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

* [Bug fortran/64522] [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default
  2015-01-07 13:11 [Bug fortran/64522] New: [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default burnus at gcc dot gnu.org
@ 2015-01-08 14:02 ` burnus at gcc dot gnu.org
  2015-01-09 10:28 ` dominiq at lps dot ens.fr
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2015-01-08 14:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64522

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Seems to be a side effect of PR39229 (r151258, 2009-08-31 = during 4.5
development) as the patch removed the following from parse.c:

-         if ((gfc_option.warn_line_truncation || gfc_current_form ==
FORM_FREE)
-             && gfc_current_locus.lb
-             && gfc_current_locus.lb->truncated)
-           gfc_warning_now ("Line truncated at %C");

Note the condition on FORM_FREE.

Possible patch (if one wants to stay with a warning and no an error):

--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -252,3 +252,3 @@ Warn about called procedures not explicitly declared
 Wline-truncation
-Fortran Warning Var(warn_line_truncation) LangEnabledBy(Fortran,Wall)
+Fortran Warning Var(warn_line_truncation) LangEnabledBy(Fortran,Wall) Init(-1)
 Warn about truncated source lines
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -307,3 +307,8 @@ gfc_post_options (const char **pfilename)
     gfc_warning_now ("%<-fd-lines-as-code%> has no effect in free form");
+
+      if (warn_line_truncation == -1)
+    warn_line_truncation = 1;
     }
+  else if (warn_line_truncation == -1)
+    warn_line_truncation = 0;


Or, alternative, for options.c if one wants to have an error; this variant
falls back to a warning if one explicitly uses -Wline-truncation (or
-Wno-error).

--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -307,0 +308,12 @@ gfc_post_options (const char **pfilename)
+
+      if (warn_line_truncation == -1)
+    {
+      warn_line_truncation = 1;
+      /* Enable -Werror=line-truncation when -Werror and -Wno-error have
+         not been set.  */
+      if (!global_options_set.x_warnings_are_errors
+          && (global_dc->classify_diagnostic[OPT_Wline_truncation] ==
+          DK_UNSPECIFIED))
+        diagnostic_classify_diagnostic (global_dc, OPT_Wline_truncation,
+                        DK_ERROR, UNKNOWN_LOCATION);
+    }
@@ -308,0 +321,2 @@ gfc_post_options (const char **pfilename)
+  else if (warn_line_truncation == -1)
+    warn_line_truncation = 0;


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

* [Bug fortran/64522] [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default
  2015-01-07 13:11 [Bug fortran/64522] New: [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default burnus at gcc dot gnu.org
  2015-01-08 14:02 ` [Bug fortran/64522] " burnus at gcc dot gnu.org
@ 2015-01-09 10:28 ` dominiq at lps dot ens.fr
  2015-01-09 11:32 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-01-09 10:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64522

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-09
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Patch at https://gcc.gnu.org/ml/fortran/2015-01/msg00033.html.


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

* [Bug fortran/64522] [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default
  2015-01-07 13:11 [Bug fortran/64522] New: [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default burnus at gcc dot gnu.org
  2015-01-08 14:02 ` [Bug fortran/64522] " burnus at gcc dot gnu.org
  2015-01-09 10:28 ` dominiq at lps dot ens.fr
@ 2015-01-09 11:32 ` rguenth at gcc dot gnu.org
  2015-01-09 14:11 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-09 11:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64522

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.8.5


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

* [Bug fortran/64522] [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default
  2015-01-07 13:11 [Bug fortran/64522] New: [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-01-09 11:32 ` rguenth at gcc dot gnu.org
@ 2015-01-09 14:11 ` jakub at gcc dot gnu.org
  2015-01-10 15:50 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-01-09 14:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64522

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
                 CC|                            |jakub at gcc dot gnu.org


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

* [Bug fortran/64522] [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default
  2015-01-07 13:11 [Bug fortran/64522] New: [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-01-09 14:11 ` jakub at gcc dot gnu.org
@ 2015-01-10 15:50 ` burnus at gcc dot gnu.org
  2015-06-23  8:25 ` [Bug fortran/64522] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2015-01-10 15:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64522

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Author: burnus
Date: Sat Jan 10 15:49:37 2015
New Revision: 219424

URL: https://gcc.gnu.org/viewcvs?rev=219424&root=gcc&view=rev
Log:
2015-01-10  Tobias Burnus  <burnus@net-b.de>

        PR fortran/64522
        * invoke.texi (Wline-truncation): Document new behaviour.
        * lang.opt (Wline-truncation): Add Init(-1).
        * options.c (gfc_post_options): If -Wline-truncation is unset,
        enable it for free-form source files; for the latter, also use
        -Werror=line-truncation, unless -Wno-error has been specified.

2015-01-10  Tobias Burnus  <burnus@net-b.de>

        PR fortran/64522
        * gfortran.dg/line_length_5.f90: Change dg-warning to dg-error
        and add dg-excess-errors.
        * gfortran.dg/line_length_6.f90: New.
        * gfortran.dg/line_length_7.f90: New.
        * gfortran.dg/line_length_8.f90: New.
        * gfortran.dg/line_length_9.f90: New.
        * gfortran.dg/line_length_10.f90: New.
        * gfortran.dg/line_length_11.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/line_length_10.f90
    trunk/gcc/testsuite/gfortran.dg/line_length_11.f90
    trunk/gcc/testsuite/gfortran.dg/line_length_6.f90
    trunk/gcc/testsuite/gfortran.dg/line_length_7.f90
    trunk/gcc/testsuite/gfortran.dg/line_length_8.f90
    trunk/gcc/testsuite/gfortran.dg/line_length_9.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/invoke.texi
    trunk/gcc/fortran/lang.opt
    trunk/gcc/fortran/options.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/line_length_4.f90
    trunk/gcc/testsuite/gfortran.dg/line_length_5.f90


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

* [Bug fortran/64522] [4.8/4.9/5/6 Regression] Free-form source code: -Wline-truncation is no longer enabled by default
  2015-01-07 13:11 [Bug fortran/64522] New: [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-01-10 15:50 ` burnus at gcc dot gnu.org
@ 2015-06-23  8:25 ` rguenth at gcc dot gnu.org
  2015-06-26 20:16 ` [Bug fortran/64522] [4.9/5/6 " jakub at gcc dot gnu.org
  2015-06-26 20:38 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-23  8:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64522

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.5                       |4.9.3

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The gcc-4_8-branch is being closed, re-targeting regressions to 4.9.3.


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

* [Bug fortran/64522] [4.9/5/6 Regression] Free-form source code: -Wline-truncation is no longer enabled by default
  2015-01-07 13:11 [Bug fortran/64522] New: [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default burnus at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-06-23  8:25 ` [Bug fortran/64522] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
@ 2015-06-26 20:16 ` jakub at gcc dot gnu.org
  2015-06-26 20:38 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 20:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64522

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.9.3 has been released.


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

* [Bug fortran/64522] [4.9/5/6 Regression] Free-form source code: -Wline-truncation is no longer enabled by default
  2015-01-07 13:11 [Bug fortran/64522] New: [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default burnus at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2015-06-26 20:16 ` [Bug fortran/64522] [4.9/5/6 " jakub at gcc dot gnu.org
@ 2015-06-26 20:38 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-06-26 20:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64522

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.3                       |4.9.4


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

end of thread, other threads:[~2015-06-26 20:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07 13:11 [Bug fortran/64522] New: [4.8/4.9/5 Regression] Free-form source code: -Wline-truncation is no longer enabled by default burnus at gcc dot gnu.org
2015-01-08 14:02 ` [Bug fortran/64522] " burnus at gcc dot gnu.org
2015-01-09 10:28 ` dominiq at lps dot ens.fr
2015-01-09 11:32 ` rguenth at gcc dot gnu.org
2015-01-09 14:11 ` jakub at gcc dot gnu.org
2015-01-10 15:50 ` burnus at gcc dot gnu.org
2015-06-23  8:25 ` [Bug fortran/64522] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 20:16 ` [Bug fortran/64522] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:38 ` jakub 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).