Blame SOURCES/gcc7-rh1570967.patch

6068c7
commit 63256634cd46529bb3e839838f03dc4164feaa4c
6068c7
Author: foreese <foreese@138bc75d-0d04-0410-961f-82ee72b054a4>
6068c7
Date:   Thu Aug 10 12:36:44 2017 +0000
6068c7
6068c7
    2017-08-10  Fritz Reese <Reese-Fritz@zai.com>
6068c7
    
6068c7
        gcc/fortran/ChangeLog:
6068c7
    
6068c7
            * options.c (set_dec_flags, gfc_post_options): Only set flag_d_lines
6068c7
            with -fdec when not set by user.
6068c7
    
6068c7
        gcc/testsuite/ChangeLog:
6068c7
    
6068c7
        gfortran.dg/
6068c7
            * dec_d_lines_1.f, dec_d_lines_2.f: New.
6068c7
    
6068c7
    
6068c7
    
6068c7
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@251024 138bc75d-0d04-0410-961f-82ee72b054a4
6068c7
6068c7
diff --git gcc/fortran/options.c gcc/fortran/options.c
6068c7
index 283c8354e06..cd254e93229 100644
6068c7
--- gcc/fortran/options.c
6068c7
+++ gcc/fortran/options.c
6068c7
@@ -57,9 +57,6 @@ set_dec_flags (int value)
6068c7
     | GFC_STD_GNU | GFC_STD_LEGACY;
6068c7
   gfc_option.warn_std &= ~(GFC_STD_LEGACY | GFC_STD_F95_DEL);
6068c7
 
6068c7
-  /* Set -fd-lines-as-comments by default.  */
6068c7
-  if (value && gfc_current_form != FORM_FREE && gfc_option.flag_d_lines == -1)
6068c7
-    gfc_option.flag_d_lines = 0;
6068c7
 
6068c7
   /* Set other DEC compatibility extensions.  */
6068c7
   flag_dollar_ok |= value;
6068c7
@@ -339,8 +336,15 @@ gfc_post_options (const char **pfilename)
6068c7
 	diagnostic_classify_diagnostic (global_dc, OPT_Wline_truncation,
6068c7
 					DK_ERROR, UNKNOWN_LOCATION);
6068c7
     }
6068c7
-  else if (warn_line_truncation == -1)
6068c7
-    warn_line_truncation = 0;
6068c7
+  else
6068c7
+    {
6068c7
+      /* With -fdec, set -fd-lines-as-comments by default in fixed form.  */
6068c7
+      if (flag_dec && gfc_option.flag_d_lines == -1)
6068c7
+	gfc_option.flag_d_lines = 0;
6068c7
+
6068c7
+      if (warn_line_truncation == -1)
6068c7
+	warn_line_truncation = 0;
6068c7
+    }
6068c7
 
6068c7
   /* If -pedantic, warn about the use of GNU extensions.  */
6068c7
   if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
6068c7
diff --git gcc/testsuite/gfortran.dg/dec_d_lines_1.f gcc/testsuite/gfortran.dg/dec_d_lines_1.f
6068c7
new file mode 100644
6068c7
index 00000000000..2cc7a01daff
6068c7
--- /dev/null
6068c7
+++ gcc/testsuite/gfortran.dg/dec_d_lines_1.f
6068c7
@@ -0,0 +1,9 @@
6068c7
+! { dg-do compile }
6068c7
+! { dg-options "-ffixed-form -fd-lines-as-code -fdec" }
6068c7
+!
6068c7
+! Ensure -fd-lines-as-code is not overridden by -fdec.
6068c7
+!
6068c7
+      i = 0
6068c7
+d     end
6068c7
+      subroutine s
6068c7
+D     end
6068c7
diff --git gcc/testsuite/gfortran.dg/dec_d_lines_2.f gcc/testsuite/gfortran.dg/dec_d_lines_2.f
6068c7
new file mode 100644
6068c7
index 00000000000..31eaf5f2328
6068c7
--- /dev/null
6068c7
+++ gcc/testsuite/gfortran.dg/dec_d_lines_2.f
6068c7
@@ -0,0 +1,8 @@
6068c7
+! { dg-do compile }
6068c7
+! { dg-options "-ffixed-form -fdec" }
6068c7
+!
6068c7
+! Ensure -fd-lines-as-comments is enabled by default with -fdec.
6068c7
+!
6068c7
+d This is a comment.
6068c7
+D This line, too.
6068c7
+      end