Blame SOURCES/gcc7-rh1570967.patch

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