Bug 1730454

Summary: Backport fixes for Firefox/Ceph issues
Product: Red Hat Enterprise Linux 8 Reporter: Marek Polacek <mpolacek>
Component: gccAssignee: Marek Polacek <mpolacek>
gcc sub component: system-version QA Contact: Alexandra Petlanová Hájková <ahajkova>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: ahajkova, fweimer, jakub, ohudlick
Version: 8.1   
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gcc-8.3.1-4.5.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-05 22:16:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marek Polacek 2019-07-16 18:51:15 UTC
We're going to be issuing a z-stream for Bug 1727979 and Bug 1726630.  These fixes are for GCC 8.  System gcc in RHEL 8 is also based on GCC 8 and as such should also include the fixes so that we don't have a regression DTS 8.1 vs system RHEL 8 compiler.  The patch:

diff --git a/gcc.spec b/gcc.spec
index 9b17c41..016ac96 100644
--- a/gcc.spec
+++ b/gcc.spec
@@ -90,7 +90,7 @@
 Summary: GCC version 8
 Name: %{?scl_prefix}gcc
 Version: %{gcc_version}
-Release: %{gcc_release}%{?dist}
+Release: %{gcc_release}.1%{?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
@@ -252,6 +252,9 @@ Patch11: gcc8-rh1512529-aarch64.patch
 Patch12: gcc8-mcet.patch
 Patch13: gcc8-pr85400.patch
 Patch14: gcc8-pr89629.patch
+Patch15: gcc8-pr90139.patch
+Patch16: gcc8-pr90756.patch
+Patch17: gcc8-pr86098.patch
 
 Patch1000: gcc8-libstdc++-compat.patch
 Patch1001: gcc8-alt-compat-test.patch
@@ -629,6 +632,9 @@ This package contains Leak Sanitizer static runtime library.
 %patch12 -p0 -b .mcet~
 %patch13 -p0 -b .pr85400~
 %patch14 -p0 -b .pr89629~
+%patch15 -p0 -b .pr90139~
+%patch16 -p0 -b .pr90756~
+%patch17 -p0 -b .pr86098~
 
 %patch1000 -p0 -b .libstdc++-compat~
 %ifarch %{ix86} x86_64
@@ -2496,6 +2502,12 @@ fi
 %doc rpm.doc/changelogs/libcc1/ChangeLog*
 
 %changelog
+* Sat Jul 13 2019 Marek Polacek <polacek> 8.3.1-3.1
+- fix tree-outof-ssa.c ICE with vector types (PR middle-end/90139, #1727979)
+- fix out-of-ssa with unsupported vector types (PR rtl-optimization/90756,
+  #1727979)
+- fix ICE with template placeholder for TTP (PR c++/86098, #1726630)
+
 * Mon Mar 11 2019 Marek Polacek <polacek> 8.3.1-3
 - update from Fedora 8.3.1-3
 - two small autoFDO fixes (#1684650)
diff --git a/gcc8-pr86098.patch b/gcc8-pr86098.patch
new file mode 100644
index 0000000..5f5a651
--- /dev/null
+++ b/gcc8-pr86098.patch
@@ -0,0 +1,39 @@
+2018-06-12  Jason Merrill  <jason>
+
+	PR c++/86098 - ICE with template placeholder for TTP.
+	* typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
+	CLASS_PLACEHOLDER_TEMPLATE.
+
+--- gcc/cp/typeck.c
++++ gcc/cp/typeck.c
+@@ -1375,6 +1375,11 @@ structural_comptypes (tree t1, tree t2, int strict)
+ 	 template parameters set, they can't be equal.  */
+       if (!comp_template_parms_position (t1, t2))
+ 	return false;
++      /* If T1 and T2 don't represent the same class template deduction,
++         they aren't equal.  */
++      if (CLASS_PLACEHOLDER_TEMPLATE (t1)
++	  != CLASS_PLACEHOLDER_TEMPLATE (t2))
++	return false;
+       /* Constrained 'auto's are distinct from parms that don't have the same
+ 	 constraints.  */
+       if (!equivalent_placeholder_constraints (t1, t2))
+--- /dev/null
++++ gcc/testsuite/g++.dg/cpp1z/class-deduction58.C
+@@ -0,0 +1,16 @@
++// PR c++/86098
++// { dg-additional-options -std=c++17 }
++
++template <class _Res> class future;
++template <class T> T&& declval();
++
++template<template <class...> class T>
++struct construct_deduced {
++  template <class... AN>
++  using deduced_t = decltype(T{declval<AN>()...});
++  template<class... AN>
++  deduced_t<AN...> operator()(AN&&... an) const;
++};
++
++template<class T>
++future<T> future_from(T singleSender);
diff --git a/gcc8-pr90139.patch b/gcc8-pr90139.patch
new file mode 100644
index 0000000..e7a5958
--- /dev/null
+++ b/gcc8-pr90139.patch
@@ -0,0 +1,40 @@
+2019-04-19  Jakub Jelinek  <jakub>
+
+	PR middle-end/90139
+	* tree-outof-ssa.c (get_temp_reg): If reg_mode is BLKmode, return
+	assign_temp instead of gen_reg_rtx.
+
+--- /dev/null
++++ gcc/testsuite/gcc.c-torture/compile/pr90139.c
+@@ -0,0 +1,20 @@
++/* PR middle-end/90139 */
++
++typedef float __attribute__((vector_size (sizeof (float)))) V;
++void bar (int, V *);
++int l;
++
++void
++foo (void)
++{
++  V n, b, o;
++  while (1)
++    switch (l)
++      {
++      case 0:
++	o = n;
++	n = b;
++	b = o;
++	bar (1, &o);
++      }
++}
+--- gcc/tree-outof-ssa.c
++++ gcc/tree-outof-ssa.c
+@@ -653,6 +653,8 @@ get_temp_reg (tree name)
+   tree type = TREE_TYPE (name);
+   int unsignedp;
+   machine_mode reg_mode = promote_ssa_mode (name, &unsignedp);
++  if (reg_mode == BLKmode)
++    return assign_temp (type, 0, 0);
+   rtx x = gen_reg_rtx (reg_mode);
+   if (POINTER_TYPE_P (type))
+     mark_reg_pointer (x, TYPE_ALIGN (TREE_TYPE (type)));
diff --git a/gcc8-pr90756.patch b/gcc8-pr90756.patch
new file mode 100644
index 0000000..c43fb18
--- /dev/null
+++ b/gcc8-pr90756.patch
@@ -0,0 +1,55 @@
+2019-07-04  Jakub Jelinek  <jakub>
+
+	PR rtl-optimization/90756
+	* explow.c (promote_ssa_mode): Always use TYPE_MODE, don't bypass it
+	for VECTOR_TYPE_P.
+
+--- gcc/explow.c
++++ gcc/explow.c
+@@ -892,16 +892,7 @@ promote_ssa_mode (const_tree name, int *punsignedp)
+ 
+   tree type = TREE_TYPE (name);
+   int unsignedp = TYPE_UNSIGNED (type);
+-  machine_mode mode = TYPE_MODE (type);
+-
+-  /* Bypass TYPE_MODE when it maps vector modes to BLKmode.  */
+-  if (mode == BLKmode)
+-    {
+-      gcc_assert (VECTOR_TYPE_P (type));
+-      mode = type->type_common.mode;
+-    }
+-
+-  machine_mode pmode = promote_mode (type, mode, &unsignedp);
++  machine_mode pmode = promote_mode (type, TYPE_MODE (type), &unsignedp);
+   if (punsignedp)
+     *punsignedp = unsignedp;
+ 
+--- /dev/null
++++ gcc/testsuite/gcc.dg/pr90756.c
+@@ -0,0 +1,26 @@
++/* PR rtl-optimization/90756 */
++/* { dg-do compile } */
++/* { dg-options "-O2 -Wno-psabi" } */
++/* { dg-additional-options "-mno-sse" { target ia32 } } */
++
++typedef float B __attribute__((vector_size(4 * sizeof (float))));
++typedef unsigned long long C __attribute__((vector_size(4 * sizeof (long long))));
++typedef short D __attribute__((vector_size(4 * sizeof (short))));
++B z;
++void foo (C);
++C bar (D);
++B baz ();
++D qux (B);
++
++void
++quux (int x)
++{
++  B n = z, b = z;
++  while (1)
++    switch (x)
++      {
++      case 0: n = baz (); /* FALLTHRU */
++      case 1: { B o = n; n = b; b = o; } /* FALLTHRU */
++      case 2: { D u = qux (b); C v = bar (u); foo (v); }
++      }
++}

Comment 1 Marek Polacek 2019-07-16 18:52:18 UTC
Patch in the previous comment.

Comment 2 Marek Polacek 2019-07-16 19:49:56 UTC
Committed.

Comment 4 Alexandra Petlanová Hájková 2019-08-23 19:32:03 UTC
The corresponding new tests gcc.dg/pr90756.c, gcc.dg/pr90756.c and gcc-8.3.1-4.5.el8gcc.dg/pr90756.c passes for gcc-8.3.1-4.5.el8.

Comment 6 errata-xmlrpc 2019-11-05 22:16:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:3565