Blame SOURCES/gcc7-rh1570967.patch

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