Blame SOURCES/gcc7-rh1570967.patch

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