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;

Reply via email to