From 726b1e553b13938636053900ab315219757fc1f2 Mon Sep 17 00:00:00 2001
From: CentOS Sources <bugs@centos.org>
Date: Mon, 07 Jan 2019 09:01:52 +0000
Subject: [PATCH] import devtoolset-7-gcc-7.3.1-5.15.el7

---
 /dev/null                                   |  240 ------------
 SOURCES/gcc7-fortran-fdec-include.patch     |  657 ++++++++++++++++++++++++++++++++++
 SOURCES/gcc7-rh1660242.patch                |   53 ++
 SOURCES/gcc7-fortran-fpad-source.patch      |  123 ++++++
 SOURCES/gcc7-fortran-fdec-include-doc.patch |   28 +
 SPECS/gcc.spec                              |   20 
 6 files changed, 877 insertions(+), 244 deletions(-)

diff --git a/SOURCES/gcc7-fortran-fdec-include-doc.patch b/SOURCES/gcc7-fortran-fdec-include-doc.patch
new file mode 100644
index 0000000..92c1d2b
--- /dev/null
+++ b/SOURCES/gcc7-fortran-fdec-include-doc.patch
@@ -0,0 +1,28 @@
+2018-11-21  Jakub Jelinek  <jakub@redhat.com>
+
+	* invoke.texi (-fdec-include): Document.
+
+--- gcc/fortran/invoke.texi
++++ gcc/fortran/invoke.texi
+@@ -117,7 +117,7 @@ by type.  Explanations are in the follow
+ @gccoptlist{-fall-intrinsics -fbackslash -fcray-pointer -fd-lines-as-code @gol
+ -fd-lines-as-comments @gol
+ -fdec -fdec-structure -fdec-intrinsic-ints -fdec-static -fdec-math @gol
+--fdefault-double-8 -fdefault-integer-8 @gol
++-fdec-include -fdefault-double-8 -fdefault-integer-8 @gol
+ -fdefault-real-8 -fdollar-ok -ffixed-line-length-@var{n} @gol
+ -ffixed-line-length-none -ffree-form -ffree-line-length-@var{n} @gol
+ -ffree-line-length-none -fimplicit-none -finteger-4-integer-8 @gol
+@@ -277,6 +277,12 @@ functions (e.g. TAND, ATAND, etc...) for compatability with older code.
+ Enable DEC-style STATIC and AUTOMATIC attributes to explicitly specify
+ the storage of variables and other objects.
+ 
++@item -fdec-include
++@opindex @code{fdec-include}
++Enable parsing of INCLUDE as a statement in addition to parsing it as
++INCLUDE line.  When parsed as INCLUDE statement, INCLUDE does not have to
++be on a single line and can use line continuations.
++
+ @item -fdollar-ok
+ @opindex @code{fdollar-ok}
+ @cindex @code{$}
diff --git a/SOURCES/gcc7-fortran-fdec-include.patch b/SOURCES/gcc7-fortran-fdec-include.patch
new file mode 100644
index 0000000..c891ff6
--- /dev/null
+++ b/SOURCES/gcc7-fortran-fdec-include.patch
@@ -0,0 +1,657 @@
+2018-11-21  Jakub Jelinek  <jakub@redhat.com>
+	    Mark Eggleston  <mark.eggleston@codethink.com>
+
+	* lang.opt (fdec-include): New option.
+	* options.c (set_dec_flags): Set also flag_dec_include.
+	* scanner.c (include_line): Change return type from bool to int.
+	In fixed form allow spaces in between include keyword letters.
+	For -fdec-include, allow in fixed form 0 in column 6.  With
+	-fdec-include return -1 if the parsed line is not full include
+	statement and it could be successfully completed on continuation
+	lines.
+	(include_stmt): New function.
+	(load_file): Adjust include_line caller.  If it returns -1, keep
+	trying include_stmt until it stops returning -1 whenever adding
+	further line of input.
+
+--- gcc/fortran/lang.opt
++++ gcc/fortran/lang.opt
+@@ -432,6 +432,10 @@ fdec-pad-with-spaces
+ Fortran Var(flag_dec_pad_with_spaces)
+ For character to integer conversions, use spaces for the pad rather than NUL.
+ 
++fdec-include
++Fortran Var(flag_dec_include)
++Enable legacy parsing of INCLUDE as statement.
++
+ fdec-intrinsic-ints
+ Fortran Var(flag_dec_intrinsic_ints)
+ Enable kind-specific variants of integer intrinsic functions.
+--- gcc/fortran/options.c
++++ gcc/fortran/options.c
+@@ -68,6 +68,7 @@ set_dec_flags (int value)
+   flag_dec_intrinsic_ints |= value;
+   flag_dec_static |= value;
+   flag_dec_math |= value;
++  flag_dec_include |= value;
+ }
+ 
+ 
+--- gcc/fortran/scanner.c
++++ gcc/fortran/scanner.c
+@@ -2135,14 +2135,18 @@ static bool load_file (const char *, const char *, bool);
+ /* include_line()-- Checks a line buffer to see if it is an include
+    line.  If so, we call load_file() recursively to load the included
+    file.  We never return a syntax error because a statement like
+-   "include = 5" is perfectly legal.  We return false if no include was
+-   processed or true if we matched an include.  */
++   "include = 5" is perfectly legal.  We return 0 if no include was
++   processed, 1 if we matched an include or -1 if include was
++   partially processed, but will need continuation lines.  */
+ 
+-static bool
++static int
+ include_line (gfc_char_t *line)
+ {
+   gfc_char_t quote, *c, *begin, *stop;
+   char *filename;
++  const char *include = "include";
++  bool allow_continuation = flag_dec_include;
++  int i;
+ 
+   c = line;
+ 
+@@ -2158,42 +2162,133 @@ include_line (gfc_char_t *line)
+       else
+ 	{
+ 	  if ((*c == '!' || *c == 'c' || *c == 'C' || *c == '*')
+-	      && c[1] == '$' && (c[2] == ' ' || c[2] == '\t'))
++	      && c[1] == '$' && c[2] == ' ')
+ 	    c += 3;
+ 	}
+     }
+ 
+-  while (*c == ' ' || *c == '\t')
+-    c++;
++  if (gfc_current_form == FORM_FREE)
++    {
++      while (*c == ' ' || *c == '\t')
++	c++;
++      if (gfc_wide_strncasecmp (c, "include", 7))
++	{
++	  if (!allow_continuation)
++	    return 0;
++	  for (i = 0; i < 7; ++i)
++	    {
++	      gfc_char_t c1 = gfc_wide_tolower (*c);
++	      if (c1 != (unsigned char) include[i])
++		break;
++	      c++;
++	    }
++	  if (i == 0 || *c != '&')
++	    return 0;
++	  c++;
++	  while (*c == ' ' || *c == '\t')
++	    c++;
++	  if (*c == '\0' || *c == '!')
++	    return -1;
++	  return 0;
++	}
+ 
+-  if (gfc_wide_strncasecmp (c, "include", 7))
+-    return false;
++      c += 7;
++    }
++  else
++    {
++      while (*c == ' ' || *c == '\t')
++	c++;
++      if (flag_dec_include && *c == '0' && c - line == 5)
++	{
++	  c++;
++	  while (*c == ' ' || *c == '\t')
++	    c++;
++	}
++      if (c - line < 6)
++	allow_continuation = false;
++      for (i = 0; i < 7; ++i)
++	{
++	  gfc_char_t c1 = gfc_wide_tolower (*c);
++	  if (c1 != (unsigned char) include[i])
++	    break;
++	  c++;
++	  while (*c == ' ' || *c == '\t')
++	    c++;
++	}
++      if (!allow_continuation)
++	{
++	  if (i != 7)
++	    return 0;
++	}
++      else if (i != 7)
++	{
++	  if (i == 0)
++	    return 0;
++
++	  /* At the end of line or comment this might be continued.  */
++	  if (*c == '\0' || *c == '!')
++	    return -1;
++
++	  return 0;
++	}
++    }
+ 
+-  c += 7;
+   while (*c == ' ' || *c == '\t')
+     c++;
+ 
+   /* Find filename between quotes.  */
+-  
++
+   quote = *c++;
+   if (quote != '"' && quote != '\'')
+-    return false;
++    {
++      if (allow_continuation)
++	{
++	  if (gfc_current_form == FORM_FREE)
++	    {
++	      if (quote == '&')
++		{
++		  while (*c == ' ' || *c == '\t')
++		    c++;
++		  if (*c == '\0' || *c == '!')
++		    return -1;
++		}
++	    }
++	  else if (quote == '\0' || quote == '!')
++	    return -1;
++	}
++      return 0;
++    }
+ 
+   begin = c;
+ 
++  bool cont = false;
+   while (*c != quote && *c != '\0')
+-    c++;
++    {
++      if (allow_continuation && gfc_current_form == FORM_FREE)
++	{
++	  if (*c == '&')
++	    cont = true;
++	  else if (*c != ' ' && *c != '\t')
++	    cont = false;
++	}
++      c++;
++    }
+ 
+   if (*c == '\0')
+-    return false;
++    {
++      if (allow_continuation
++	  && (cont || gfc_current_form != FORM_FREE))
++	return -1;
++      return 0;
++    }
+ 
+   stop = c++;
+-  
++
+   while (*c == ' ' || *c == '\t')
+     c++;
+ 
+   if (*c != '\0' && *c != '!')
+-    return false;
++    return 0;
+ 
+   /* We have an include line at this point.  */
+ 
+@@ -2205,9 +2300,130 @@ include_line (gfc_char_t *line)
+     exit (FATAL_EXIT_CODE);
+ 
+   free (filename);
+-  return true;
++  return 1;
+ }
+ 
++/* Similarly, but try to parse an INCLUDE statement, using gfc_next_char etc.
++   APIs.  Return 1 if recognized as valid INCLUDE statement and load_file has
++   been called, 0 if it is not a valid INCLUDE statement and -1 if eof has
++   been encountered while parsing it.  */
++static int
++include_stmt (gfc_linebuf *b)
++{
++  int ret = 0, i, length;
++  const char *include = "include";
++  gfc_char_t c, quote = 0;
++  locus str_locus;
++  char *filename;
++
++  continue_flag = 0;
++  end_flag = 0;
++  gcc_attribute_flag = 0;
++  openmp_flag = 0;
++  openacc_flag = 0;
++  continue_count = 0;
++  continue_line = 0;
++  gfc_current_locus.lb = b;
++  gfc_current_locus.nextc = b->line;
++
++  gfc_skip_comments ();
++  gfc_gobble_whitespace ();
++
++  for (i = 0; i < 7; i++)
++    {
++      c = gfc_next_char ();
++      if (c != (unsigned char) include[i])
++	{
++	  if (gfc_current_form == FORM_FIXED
++	      && i == 0
++	      && c == '0'
++	      && gfc_current_locus.nextc == b->line + 6)
++	    {
++	      gfc_gobble_whitespace ();
++	      i--;
++	      continue;
++	    }
++	  gcc_assert (i != 0);
++	  if (c == '\n')
++	    {
++	      gfc_advance_line ();
++	      gfc_skip_comments ();
++	      if (gfc_at_eof ())
++		ret = -1;
++	    }
++	  goto do_ret;
++	}
++    }
++  gfc_gobble_whitespace ();
++
++  c = gfc_next_char ();
++  if (c == '\'' || c == '"')
++    quote = c;
++  else
++    {
++      if (c == '\n')
++	{
++	  gfc_advance_line ();
++	  gfc_skip_comments ();
++	  if (gfc_at_eof ())
++	    ret = -1;
++	}
++      goto do_ret;
++    }
++
++  str_locus = gfc_current_locus;
++  length = 0;
++  do
++    {
++      c = gfc_next_char_literal (INSTRING_NOWARN);
++      if (c == quote)
++	break;
++      if (c == '\n')
++	{
++	  gfc_advance_line ();
++	  gfc_skip_comments ();
++	  if (gfc_at_eof ())
++	    ret = -1;
++	  goto do_ret;
++	}
++      length++;
++    }
++  while (1);
++
++  gfc_gobble_whitespace ();
++  c = gfc_next_char ();
++  if (c != '\n')
++    goto do_ret;
++
++  gfc_current_locus = str_locus;
++  ret = 1;
++  filename = XNEWVEC (char, length + 1);
++  for (i = 0; i < length; i++)
++    {
++      c = gfc_next_char_literal (INSTRING_WARN);
++      gcc_assert (gfc_wide_fits_in_byte (c));
++      filename[i] = (unsigned char) c;
++    }
++  filename[length] = '\0';
++  if (!load_file (filename, NULL, false))
++    exit (FATAL_EXIT_CODE);
++
++  free (filename);
++
++do_ret:
++  continue_flag = 0;
++  end_flag = 0;
++  gcc_attribute_flag = 0;
++  openmp_flag = 0;
++  openacc_flag = 0;
++  continue_count = 0;
++  continue_line = 0;
++  memset (&gfc_current_locus, '\0', sizeof (locus));
++  memset (&openmp_locus, '\0', sizeof (locus));
++  memset (&openacc_locus, '\0', sizeof (locus));
++  memset (&gcc_attribute_locus, '\0', sizeof (locus));
++  return ret;
++}
+ 
+ /* Load a file into memory by calling load_line until the file ends.  */
+ 
+@@ -2215,7 +2431,7 @@ static bool
+ load_file (const char *realfilename, const char *displayedname, bool initial)
+ {
+   gfc_char_t *line;
+-  gfc_linebuf *b;
++  gfc_linebuf *b, *include_b = NULL;
+   gfc_file *f;
+   FILE *input;
+   int len, line_len;
+@@ -2318,6 +2534,7 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
+   for (;;)
+     {
+       int trunc = load_line (input, &line, &line_len, NULL);
++      int inc_line;
+ 
+       len = gfc_wide_strlen (line);
+       if (feof (input) && len == 0)
+@@ -2366,11 +2583,12 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
+ 	}
+ 
+       /* Preprocessed files have preprocessor lines added before the byte
+-         order mark, so first_line is not about the first line of the file
++	 order mark, so first_line is not about the first line of the file
+ 	 but the first line that's not a preprocessor line.  */
+       first_line = false;
+ 
+-      if (include_line (line))
++      inc_line = include_line (line);
++      if (inc_line > 0)
+ 	{
+ 	  current_file->line++;
+ 	  continue;
+@@ -2403,6 +2621,36 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
+ 
+       while (file_changes_cur < file_changes_count)
+ 	file_changes[file_changes_cur++].lb = b;
++
++      if (flag_dec_include)
++	{
++	  if (include_b && b != include_b)
++	    {
++	      int inc_line2 = include_stmt (include_b);
++	      if (inc_line2 == 0)
++		include_b = NULL;
++	      else if (inc_line2 > 0)
++		{
++		  do
++		    {
++		      if (gfc_current_form == FORM_FIXED)
++			{
++			  for (gfc_char_t *p = include_b->line; *p; p++)
++			    *p = ' ';
++			}
++		      else
++			include_b->line[0] = '\0';
++                      if (include_b == b)
++			break;
++		      include_b = include_b->next;
++		    }
++		  while (1);
++		  include_b = NULL;
++		}
++	    }
++	  if (inc_line == -1 && !include_b)
++	    include_b = b;
++	}
+     }
+ 
+   /* Release the line buffer allocated in load_line.  */
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/gomp/include_1.f
+@@ -0,0 +1,49 @@
++c { dg-do compile }
++c { dg-options "-fopenmp -fdec" }
++      subroutine foo
++      implicit none
++c$   0include 'include_1.inc'
++      i = 1
++      end subroutine foo
++      subroutine bar
++      implicit none
++      i
++C$   ;n
++     +c
++                 
++c   some comment
++
++*$   ll
++C comment line
++     uu
++     DD
++     ee'include_1.inc'
++      i = 1
++      end subroutine bar
++      subroutine baz
++      implicit none
++     0include
++     + 'include_1.inc'
++      i = 1
++      end subroutine baz
++      subroutine qux
++      implicit none
++!$     i   n   C   lude                                             'inc
++* another comment line
++     &lude_1.inc'
++      i = 1
++      end subroutine qux
++       subroutine quux
++       implicit none
++C$   0inc
++*$   1lud
++c$   2e                                                                '
++!$   3include_1.inc'
++      i = 1
++      end subroutine quux
++      program include_12
++      implicit none
++      include
++! comment
++c$   +'include_1.inc'
++      end program
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/gomp/include_1.inc
+@@ -0,0 +1 @@
++      integer i
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/gomp/include_2.f90
+@@ -0,0 +1,32 @@
++! { dg-do compile }
++! { dg-options "-fopenmp -fdec-include" }
++subroutine foo
++  implicit none
++!$  incl& ! comment1
++!$ &u&
++!$       &de           &     ! comment2
++!$ 'include&
++  &_1.inc'
++  i = 1
++end subroutine foo
++subroutine bar
++  implicit none
++!$ include &
++
++! comment3
++
++!$ "include_1.inc"
++  i = 1
++end subroutine bar
++subroutine baz
++  implicit none
++!$                                  include&
++!$ &'include_1.&
++!$ &inc'
++  i = 1
++end subroutine baz
++subroutine qux
++  implicit none
++!$  include '&
++include_1.inc'
++end subroutine qux
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/include_10.f
+@@ -0,0 +1,11 @@
++c { dg-do compile }
++      subroutine foo
++      implicit none
++      include 'include_10.inc'
++      i = 1
++      end subroutine foo
++      subroutine bar
++      implicit none
++      i n cl UD e'include_10.inc'
++      i = 1
++      end subroutine bar
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/include_10.inc
+@@ -0,0 +1 @@
++      integer i
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/include_11.f
+@@ -0,0 +1,20 @@
++c { dg-do compile }
++      subroutine foo
++      implicit none
++c We used to accept following in fixed mode.  Shall we at least
++c warn about it?
++include 'include_10.inc'
++      i = 1
++      end subroutine foo
++      subroutine bar
++c Likewise here.
++      implicit none
++  include'include_10.inc'
++      i = 1
++      end subroutine bar
++      subroutine baz
++c And here.
++      implicit none
++     include 'include_10.inc'
++      i = 1
++      end subroutine baz
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/include_12.f
+@@ -0,0 +1,65 @@
++c { dg-do compile }
++c { dg-options "-fdec-include" }
++      subroutine foo
++      implicit none
++     0include 'include_10.inc'
++      i = 1
++      end subroutine foo
++      subroutine bar
++      implicit none
++      i
++     ;n
++     +c
++                 
++c   some comment
++
++     ll
++C comment line
++     uu
++     DD
++     ee'include_10.inc'
++      i = 1
++      end subroutine bar
++      subroutine baz
++      implicit none
++     0include
++     + 'include_10.inc'
++      i = 1
++      end subroutine baz
++      subroutine qux
++      implicit none
++       i   n   C   lude                                             'inc
++* another comment line
++     &lude_10.inc'
++      i = 1
++      end subroutine qux
++       subroutine quux
++       implicit none
++     0inc
++     1lud
++     2e                                                                '
++     3include_10.inc'
++      i = 1
++      end subroutine quux
++      program include_12
++      implicit none
++      include
++! comment
++     +'include_10.inc'
++      end program
++      subroutine quuz
++      implicit none
++      integer include
++      include
++     +"include_10.inc"
++      i = 1
++      include
++     + = 2
++      write (*,*) include
++      end subroutine quuz
++      subroutine corge
++      implicit none
++      include
++     +'include_10.inc'
++      i = 1
++      end subroutine corge
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/include_13.f90
+@@ -0,0 +1,44 @@
++! { dg-do compile }
++! { dg-options "-fdec" }
++subroutine foo
++  implicit none
++  incl& ! comment1
++&u&
++       &de           &     ! comment2
++'include&
++  &_10.inc'
++  i = 1
++end subroutine foo
++subroutine bar
++  implicit none
++include &
++
++! comment3
++
++"include_10.inc"
++  i = 1
++end subroutine bar
++subroutine baz
++  implicit none
++                                  include&
++&'include_10.&
++&inc'
++  i = 1
++end subroutine baz
++subroutine qux
++  implicit none
++  include '&
++include_10.inc'
++end subroutine qux
++subroutine quux
++  implicit none
++  include &
++  &'include_10.inc'
++  i = 1
++end subroutine quux
++subroutine quuz
++  implicit none
++  include &
++  &"include_10.inc"
++  i = 1
++end subroutine quuz
diff --git a/SOURCES/gcc7-fortran-fpad-source.patch b/SOURCES/gcc7-fortran-fpad-source.patch
new file mode 100644
index 0000000..6694e6f
--- /dev/null
+++ b/SOURCES/gcc7-fortran-fpad-source.patch
@@ -0,0 +1,123 @@
+2018-11-23  Jakub Jelinek  <jakub@redhat.com>
+
+	* lang.opt (fpad-source): New option.
+	* scanner.c (load_line): Don't pad fixed form lines if
+	!flag_pad_source.
+	* invoke.texi (-fno-pad-source): Document.
+
+--- gcc/fortran/invoke.texi
++++ gcc/fortran/invoke.texi
+@@ -119,7 +119,7 @@ by type.  Explanations are in the follow
+ -fdec -fdec-structure -fdec-intrinsic-ints -fdec-static -fdec-math @gol
+ -fdec-include -fdefault-double-8 -fdefault-integer-8 @gol
+ -fdefault-real-8 -fdollar-ok -ffixed-line-length-@var{n} @gol
+--ffixed-line-length-none -ffree-form -ffree-line-length-@var{n} @gol
++-ffixed-line-length-none -fpad-source -ffree-form -ffree-line-length-@var{n} @gol
+ -ffree-line-length-none -fimplicit-none -finteger-4-integer-8 @gol
+ -fmax-identifier-length -fmodule-private -ffixed-form -fno-range-check @gol
+ -fopenacc -fopenmp -freal-4-real-10 -freal-4-real-16 -freal-4-real-8 @gol
+@@ -321,8 +321,9 @@ declared as @code{PUBLIC}.
+ @opindex @code{ffixed-line-length-}@var{n}
+ @cindex file format, fixed
+ Set column after which characters are ignored in typical fixed-form
+-lines in the source file, and through which spaces are assumed (as
+-if padded to that length) after the ends of short fixed-form lines.
++lines in the source file, and, unless @code{-fno-pad-source}, through which
++spaces are assumed (as if padded to that length) after the ends of short
++fixed-form lines.
+ 
+ Popular values for @var{n} include 72 (the
+ standard and the default), 80 (card image), and 132 (corresponding
+@@ -333,6 +334,15 @@ to them to fill out the line.
+ @option{-ffixed-line-length-0} means the same thing as
+ @option{-ffixed-line-length-none}.
+ 
++@item -fno-pad-source
++@opindex @code{fpad-source}
++By default fixed-form lines have spaces assumed (as if padded to that length)
++after the ends of short fixed-form lines.  This is not done either if
++@option{-ffixed-line-length-0}, @option{-ffixed-line-length-none} or
++if @option{-fno-pad-source} option is used.  With any of those options
++continued character constants never have implicit spaces appended
++to them to fill out the line.
++
+ @item -ffree-line-length-@var{n}
+ @opindex @code{ffree-line-length-}@var{n}
+ @cindex file format, free
+--- gcc/fortran/lang.opt
++++ gcc/fortran/lang.opt
+@@ -536,6 +536,10 @@ ffixed-line-length-
+ Fortran RejectNegative Joined UInteger Var(flag_fixed_line_length) Init(72)
+ -ffixed-line-length-<n>	Use n as character line width in fixed mode.
+ 
++fpad-source
++Fortran Var(flag_pad_source) Init(1)
++Pad shorter fixed form lines to line width with spaces.
++
+ ffpe-trap=
+ Fortran RejectNegative JoinedOrMissing
+ -ffpe-trap=[...]	Stop on following floating point exceptions.
+--- gcc/fortran/scanner.c
++++ gcc/fortran/scanner.c
+@@ -1924,6 +1924,7 @@ next_char:
+   /* Pad lines to the selected line length in fixed form.  */
+   if (gfc_current_form == FORM_FIXED
+       && flag_fixed_line_length != 0
++      && flag_pad_source
+       && !preprocessor_flag
+       && c != EOF)
+     {
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/pad_source_1.f
+@@ -0,0 +1,8 @@
++c { dg-do run }
++c { dg-skip-if "non-standard options" { *-*-* } { "-ffixed-line-length*" "-f*pad-source" } }
++      character(80) a
++      a = 'abc
++     +def'
++      if (a(:61) .ne. 'abc') stop 1
++      if (a(62:) .ne. 'def') stop 2
++      end
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/pad_source_2.f
+@@ -0,0 +1,9 @@
++c { dg-do run }
++c { dg-skip-if "non-standard options" { *-*-* } { "-ffixed-line-length*" } }
++c { dg-options "-fpad-source" }
++      character(80) a
++      a = 'abc
++     +def'
++      if (a(:61) .ne. 'abc') stop 1
++      if (a(62:) .ne. 'def') stop 2
++      end
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/pad_source_3.f
+@@ -0,0 +1,8 @@
++c { dg-do run }
++c { dg-skip-if "non-standard options" { *-*-* } { "-ffixed-line-length*" } }
++c { dg-options "-fno-pad-source" }
++      character(80) a
++      a = 'abc
++     +def'
++      if (a .ne. 'abcdef') stop 1
++      end
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/pad_source_4.f
+@@ -0,0 +1,7 @@
++c { dg-do run }
++c { dg-options "-ffixed-line-length-none" }
++      character(80) a
++      a = 'abc
++     +def'
++      if (a .ne. 'abcdef') stop 1
++      end
+--- /dev/null
++++ gcc/testsuite/gfortran.dg/pad_source_5.f
+@@ -0,0 +1,7 @@
++c { dg-do run }
++c { dg-options "-ffixed-line-length-0" }
++      character(80) a
++      a = 'abc
++     +def'
++      if (a .ne. 'abcdef') stop 1
++      end
diff --git a/SOURCES/gcc7-fortran-include.patch b/SOURCES/gcc7-fortran-include.patch
deleted file mode 100644
index 7b9a305..0000000
--- a/SOURCES/gcc7-fortran-include.patch
+++ /dev/null
@@ -1,240 +0,0 @@
-commit 858a1903ea946c9947d492209453a8973846b9f7
-Author: Jeff Law <law@torsion.usersys.redhat.com>
-Date:   Tue May 29 13:56:59 2018 -0400
-
-    Fix bloomberg INCLUDE issue
-
-diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
-index 55d6daf..9c9a208 100644
---- a/gcc/fortran/scanner.c
-+++ b/gcc/fortran/scanner.c
-@@ -2129,6 +2129,38 @@ preprocessor_line (gfc_char_t *c)
-   current_file->line++;
- }
- 
-+/* Add LINE with length LEN and truncation status TRUNC to
-+   FILE_CHANGES.  */
-+static void
-+add_line (gfc_char_t *line, int len, int trunc)
-+{
-+  gfc_linebuf *b;
-+
-+  b = XCNEWVAR (gfc_linebuf, gfc_linebuf_header_size
-+		+ (len + 1) * sizeof (gfc_char_t));
-+
-+
-+  b->location = linemap_line_start (line_table, current_file->line++, len);
-+  /* ??? We add the location for the maximum column possible here,
-+     because otherwise if the next call creates a new line-map, it
-+     will not reserve space for any offset.  */
-+  if (len > 0)
-+    linemap_position_for_column (line_table, len);
-+
-+  b->file = current_file;
-+  b->truncated = trunc;
-+  wide_strcpy (b->line, line);
-+
-+  if (line_head == NULL)
-+    line_head = b;
-+  else
-+    line_tail->next = b;
-+
-+  line_tail = b;
-+
-+  while (file_changes_cur < file_changes_count)
-+    file_changes[file_changes_cur++].lb = b;
-+}
- 
- static bool load_file (const char *, const char *, bool);
- 
-@@ -2139,7 +2171,7 @@ static bool load_file (const char *, const char *, bool);
-    processed or true if we matched an include.  */
- 
- static bool
--include_line (gfc_char_t *line)
-+include_line (FILE *input, gfc_char_t *line, int *len, int *trunc)
- {
-   gfc_char_t quote, *c, *begin, *stop;
-   char *filename;
-@@ -2173,6 +2205,33 @@ include_line (gfc_char_t *line)
-   while (*c == ' ' || *c == '\t')
-     c++;
- 
-+  /* If we have reached EOL, read ahead to find the quote.  We eat
-+     any whitespace.  We use getchar behind the back of load_line and
-+     put it back if we do not find what we are looking for.  */
-+  int new_line_len = 0;
-+  int new_trunc = 0;
-+  gfc_char_t *new_line = NULL;
-+  if (*c == '\0')
-+    {
-+      unsigned char x;
-+
-+      do
-+	x = getc (input);
-+      while (x == ' ' || x == '\t' || x == '\r' || x == '\n');
-+
-+      /* Always put the character back.  */
-+      ungetc (x, input);
-+
-+      /* If we did not fine the quote, put the character back and
-+	 return that no INCLUDE has processed.  */
-+      if (x != '"' && x != '\'')
-+	return false;
-+
-+      /* Read the next line and continue processing.  */
-+      new_trunc = load_line (input, &new_line, &new_line_len, NULL);
-+      c = new_line;
-+    }
-+
-   /* Find filename between quotes.  */
-   
-   quote = *c++;
-@@ -2184,16 +2243,45 @@ include_line (gfc_char_t *line)
-   while (*c != quote && *c != '\0')
-     c++;
- 
-+  /* Reached EOL without finding ending quote.  */
-   if (*c == '\0')
--    return false;
-+    {
-+      /* If we loaded another line, then we want to add the
-+	 original line and return the current line.
-+
-+	 We do not try to support multi-line filenames for
-+	 INCLUDE statements.  */
-+      if (new_line)
-+	{
-+	  add_line (line, *len, *trunc);
-+	  *line = *new_line;
-+	  *len = new_line_len;
-+	  *trunc = new_trunc;
-+	}
-+      return false;
-+    }
- 
-   stop = c++;
-   
-+  /* Consume trailing whitespace on this line.  */
-   while (*c == ' ' || *c == '\t')
-     c++;
- 
-+  /* If we encounter real characters before reaching EOL, then
-+     we do not consider this an include line.  */
-   if (*c != '\0' && *c != '!')
--    return false;
-+    {
-+      /* If we loaded another line, then we want to add the
-+	 original line and return the current line.  */
-+      if (new_line)
-+	{
-+	  add_line (line, *len, *trunc);
-+	  *line = *new_line;
-+	  *len = new_line_len;
-+	  *trunc = new_trunc;
-+	}
-+      return false;
-+    }
- 
-   /* We have an include line at this point.  */
- 
-@@ -2215,7 +2303,6 @@ static bool
- load_file (const char *realfilename, const char *displayedname, bool initial)
- {
-   gfc_char_t *line;
--  gfc_linebuf *b;
-   gfc_file *f;
-   FILE *input;
-   int len, line_len;
-@@ -2370,39 +2457,13 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
- 	 but the first line that's not a preprocessor line.  */
-       first_line = false;
- 
--      if (include_line (line))
-+      if (include_line (input, line, &len, &trunc))
- 	{
- 	  current_file->line++;
- 	  continue;
- 	}
- 
--      /* Add line.  */
--
--      b = XCNEWVAR (gfc_linebuf, gfc_linebuf_header_size
--		    + (len + 1) * sizeof (gfc_char_t));
--
--
--      b->location
--	= linemap_line_start (line_table, current_file->line++, len);
--      /* ??? We add the location for the maximum column possible here,
--	 because otherwise if the next call creates a new line-map, it
--	 will not reserve space for any offset.  */
--      if (len > 0)
--	linemap_position_for_column (line_table, len);
--
--      b->file = current_file;
--      b->truncated = trunc;
--      wide_strcpy (b->line, line);
--
--      if (line_head == NULL)
--	line_head = b;
--      else
--	line_tail->next = b;
--
--      line_tail = b;
--
--      while (file_changes_cur < file_changes_count)
--	file_changes[file_changes_cur++].lb = b;
-+      add_line (line, len, trunc);
-     }
- 
-   /* Release the line buffer allocated in load_line.  */
-diff --git a/gcc/testsuite/gfortran.dg/include_10.f90 b/gcc/testsuite/gfortran.dg/include_10.f90
-new file mode 100644
-index 0000000..5a9bb5b
---- /dev/null
-+++ b/gcc/testsuite/gfortran.dg/include_10.f90
-@@ -0,0 +1,11 @@
-+! { dg-do compile }
-+!
-+! Ensure that we handle the pathname on a separate line than
-+! the include directivbe
-+!
-+
-+subroutine one()
-+  include
-+   "include_4.inc"
-+  integer(i4) :: i
-+end subroutine one
-diff --git a/gcc/testsuite/gfortran.dg/include_11.f90 b/gcc/testsuite/gfortran.dg/include_11.f90
-new file mode 100644
-index 0000000..44b23e03
---- /dev/null
-+++ b/gcc/testsuite/gfortran.dg/include_11.f90
-@@ -0,0 +1,10 @@
-+! { dg-do compile }
-+!
-+! Ensure that we can make an assignment to a variable named
-+! include.
-+!
-+
-+subroutine one()
-+  integer :: include
-+  include = 5
-+end subroutine one
-diff --git a/gcc/testsuite/gfortran.dg/include_12.f90 b/gcc/testsuite/gfortran.dg/include_12.f90
-new file mode 100644
-index 0000000..8679b20
---- /dev/null
-+++ b/gcc/testsuite/gfortran.dg/include_12.f90
-@@ -0,0 +1,11 @@
-+! { dg-do compile }
-+!
-+! Ensure we can make an assignment to a variable named include using
-+! a line continuation
-+!
-+
-+subroutine one()
-+  integer :: include
-+  include &
-+     = 5
-+end subroutine one
diff --git a/SOURCES/gcc7-rh1660242.patch b/SOURCES/gcc7-rh1660242.patch
new file mode 100644
index 0000000..9ae6a95
--- /dev/null
+++ b/SOURCES/gcc7-rh1660242.patch
@@ -0,0 +1,53 @@
+commit 0ff050a998827c27f216c373331d643b7875d5a7
+Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date:   Sat Mar 10 03:35:17 2018 +0000
+
+            PR c++/84785 - ICE with alias template and default targs.
+    
+            * pt.c (type_unification_real): Set processing_template_decl if
+            saw_undeduced == 1.
+    
+    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@258409 138bc75d-0d04-0410-961f-82ee72b054a4
+
+diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
+index 9815df63c28..b4032550849 100644
+--- a/gcc/cp/pt.c
++++ b/gcc/cp/pt.c
+@@ -19490,7 +19490,13 @@ type_unification_real (tree tparms,
+ 	  location_t save_loc = input_location;
+ 	  if (DECL_P (parm))
+ 	    input_location = DECL_SOURCE_LOCATION (parm);
++
++	  if (saw_undeduced == 1)
++	    ++processing_template_decl;
+ 	  arg = tsubst_template_arg (arg, full_targs, complain, NULL_TREE);
++	  if (saw_undeduced == 1)
++	    --processing_template_decl;
++
+ 	  if (arg != error_mark_node && !uses_template_parms (arg))
+ 	    arg = convert_template_argument (parm, arg, full_targs, complain,
+ 					     i, NULL_TREE);
+diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-63.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-63.C
+new file mode 100644
+index 00000000000..04fb42d9e09
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-63.C
+@@ -0,0 +1,18 @@
++// PR c++/84785
++// { dg-do compile { target c++11 } }
++
++template <typename> struct A;
++template <bool> struct B;
++template <bool B, typename> using enable_if_t = typename B<B>::type;
++template <long> using type_pack_element = int;
++struct variant {
++  variant() {}
++  template <typename Arg, long I = Arg::type::value,
++            typename = type_pack_element<I>, enable_if_t<A<Arg>::value, int>>
++  variant(Arg &&);
++};
++
++struct S {
++  variant var;
++};
++int main() { S s; }
diff --git a/SPECS/gcc.spec b/SPECS/gcc.spec
index 0ffe51e..8beffec 100644
--- a/SPECS/gcc.spec
+++ b/SPECS/gcc.spec
@@ -95,7 +95,7 @@
 Summary: GCC version 7
 Name: %{?scl_prefix}gcc
 Version: %{gcc_version}
-Release: %{gcc_release}.13%{?dist}
+Release: %{gcc_release}.15%{?dist}
 # libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
 # GCC Runtime Exception.
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
@@ -260,6 +260,7 @@
 Patch15: gcc7-pr84128.patch
 Patch16: gcc7-rh1570967.patch
 Patch17: gcc7-pr86138.patch
+Patch18: gcc7-rh1660242.patch
 
 Patch1000: gcc7-libstdc++-compat.patch
 Patch1001: gcc7-alt-compat-test.patch
@@ -294,9 +295,10 @@
 Patch3020: 0020-Add-test-for-STRUCTURE-and-RECORD.patch
 Patch3022: 0022-Default-values-for-certain-field-descriptors-in-form.patch
 Patch3023: gcc7-fortranlines.patch
-Patch3024: gcc7-fortran-include.patch
 Patch3025: gcc7-fortran-equivalence.patch
-
+Patch3026: gcc7-fortran-fdec-include.patch
+Patch3027: gcc7-fortran-fdec-include-doc.patch
+Patch3028: gcc7-fortran-fpad-source.patch
 
 
 %if 0%{?rhel} >= 7
@@ -692,6 +694,7 @@
 %patch15 -p0 -b .pr84128~
 %patch16 -p0 -b .rh1570967~
 %patch17 -p0 -b .pr86138~
+%patch18 -p1 -b .rh1660242~
 
 %if 0%{?rhel} <= 7
 %patch1000 -p0 -b .libstdc++-compat~
@@ -748,8 +751,10 @@
 %patch3020 -p1 -b .fortran20~
 %patch3022 -p1 -b .fortran22~
 %patch3023 -p1 -b .fortran23~
-%patch3024 -p1 -b .fortran24~
 %patch3025 -p1 -b .fortran25~
+%patch3026 -p0 -b .fortran26~
+%patch3027 -p0 -b .fortran27~
+%patch3028 -p0 -b .fortran28~
 %endif
 
 echo 'Red Hat %{version}-%{gcc_release}' > gcc/DEV-PHASE
@@ -2905,6 +2910,13 @@
 %doc rpm.doc/changelogs/libcc1/ChangeLog*
 
 %changelog
+* Mon Dec 17 2018 Jeff Law <polacek@redhat.com> 7.3.1-5.15
+- Fix C++ ICE (#1660242)
+
+* Wed Dec  5 2018 Marek Polacek <polacek@redhat.com> 7.3.1-5.14
+- drop gcc7-fortran-include.patch
+- add -fdec-include and -fpad-source (#1647042)
+
 * Tue Aug 14 2018 Marek Polacek <polacek@redhat.com> 7.3.1-5.13
 - prevent implicit instantiation of COW empty rep (#1572583)
 

--
Gitblit v1.8.0