public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2023-04-12  7:40 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2023-04-12  7:40 UTC (permalink / raw
  To: gentoo-commits

commit:     e753e969fe0d9dffb1a68e4358821cddbf11bca6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 12 07:38:52 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr 12 07:39:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e753e969

sys-devel/gcc: backport DSE fix for std::optional for 13

Probably wouldn't do this by itself but given I've just pushed the
SLP fix (989bee28461116343b958e978fe19472fe2ea3cb) and nobody will have built
that yet, let's just do it given it's a miscompilation.

Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109434
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch | 63 ++++++++++++++++++++++
 sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild     | 58 ++++++++++++++++++++
 2 files changed, 121 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch
new file mode 100644
index 000000000000..5d45d8f4e018
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch
@@ -0,0 +1,63 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6e3e708dbadaae7b504af7fc4410015624793f02
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109434
+
+From 6e3e708dbadaae7b504af7fc4410015624793f02 Mon Sep 17 00:00:00 2001
+From: Richard Biener <rguenther@suse.de>
+Date: Tue, 11 Apr 2023 15:06:59 +0200
+Subject: [PATCH] tree-optimization/109434 - bogus DSE of throwing call LHS
+
+The byte tracking of call LHS didn't properly handle possibly
+throwing calls correctly which cases bogus DSE and in turn, for the
+testcase a bogus uninit diagnostic and (unreliable) wrong-code.
+
+	PR tree-optimization/109434
+	* tree-ssa-dse.cc (initialize_ao_ref_for_dse): Properly
+	handle possibly throwing calls when processing the LHS
+	and may-defs are not OK.
+
+	* g++.dg/opt/pr109434.C: New testcase.
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/opt/pr109434.C
+@@ -0,0 +1,28 @@
++// { dg-do compile }
++// { dg-require-effective-target c++17 }
++// { dg-options "-O2 -Wall" }
++
++#include <optional>
++#include <stdexcept>
++
++std::optional<int> foo()
++{
++  volatile int x = 1;
++  if (x)
++    throw std::runtime_error("haha");
++  return 42;
++}
++
++int main()
++{
++  std::optional<int> optInt;
++  try {
++      // We falsely DSEd the LHS of the call even though foo throws
++      // which results in an uninitialized diagnostic
++      optInt = foo();
++  } catch (...) {
++      return optInt.has_value();
++  }
++  std::optional<double> optDbl{optInt};
++  return optDbl ? optDbl.value () : 2.0;
++}
+--- a/gcc/tree-ssa-dse.cc
++++ b/gcc/tree-ssa-dse.cc
+@@ -179,7 +179,8 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write, bool may_def_ok = false)
+     }
+   if (tree lhs = gimple_get_lhs (stmt))
+     {
+-      if (TREE_CODE (lhs) != SSA_NAME)
++      if (TREE_CODE (lhs) != SSA_NAME
++	  && (may_def_ok || !stmt_could_throw_p (cfun, stmt)))
+ 	{
+ 	  ao_ref_init (write, lhs);
+ 	  return true;
+-- 
+2.31.1

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild b/sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild
new file mode 100644
index 000000000000..073f68b644ac
--- /dev/null
+++ b/sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+TOOLCHAIN_PATCH_DEV="sam"
+PATCH_VER="9"
+PATCH_GCC_VER="13.1.0"
+MUSL_VER="1"
+MUSL_GCC_VER="13.1.0"
+
+if [[ $(ver_cut 3) == 9999 ]] ; then
+	MY_PV_2=$(ver_cut 2)
+	MY_PV_3=$(($(ver_cut 3) - 9998))
+	if [[ ${MY_PV_2} == 0 ]] ; then
+		MY_PV_2=0
+		MY_PV_3=0
+	else
+		MY_PV_2=$(($(ver_cut 2) - 1))
+	fi
+
+	# e.g. 12.2.9999 -> 12.1.1
+	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.${MY_PV_3}
+fi
+
+inherit toolchain
+# Needs to be after inherit (for now?), bug #830908
+EGIT_BRANCH=master
+
+# Don't keyword live ebuilds
+if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~loong"
+fi
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
+	# If GCC is enabling CET by default, we need glibc to be built with support for it.
+	# bug #830454
+	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
+	DEPEND="${RDEPEND}"
+	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
+fi
+
+src_prepare() {
+	local p upstreamed_patches=(
+		# add them here
+	)
+	for p in "${upstreamed_patches[@]}"; do
+		rm -v "${WORKDIR}/patch/${p}" || die
+	done
+
+	toolchain_src_prepare
+
+	eapply "${FILESDIR}"/${P}-PR109469-SLP-returns-twice.patch
+	eapply "${FILESDIR}"/${P}-PR109434-DSE-throw.patch
+	eapply_user
+}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2024-11-19  3:52 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2024-11-19  3:52 UTC (permalink / raw
  To: gentoo-commits

commit:     d2facc542948cfb79193220e7beb9d1c9837df8a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 19 03:48:42 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Nov 19 03:52:22 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2facc54

sys-devel/gcc: backport C23 fix to 15.0.0_pre20241117

Backport a -std=gnu23/-std=c23 fix to 15.0.0_pre20241117 which prevented
coersion from _Bool to NULL. Note that this is still dodgy code and some
are proposing this be banned in a future C version (maybe even C2y), but
it shouldn't be rejected in this version at least.

I've added Closes tags for all bugs which, at a glance, look related,
but I haven't re-tested them all and one or two might need reopening.

Bug: https://gcc.gnu.org/PR112556
Closes: https://bugs.gentoo.org/943862
Closes: https://bugs.gentoo.org/943861
Closes: https://bugs.gentoo.org/943843
Closes: https://bugs.gentoo.org/943811
Closes: https://bugs.gentoo.org/943809
Closes: https://bugs.gentoo.org/943753
Closes: https://bugs.gentoo.org/943715
Closes: https://bugs.gentoo.org/943704
Closes: https://bugs.gentoo.org/942958
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...llow-bool-and-enum-null-pointer-constants.patch | 244 +++++++++++++++++++++
 sys-devel/gcc/gcc-15.0.0_pre20241117-r2.ebuild     |  54 +++++
 2 files changed, 298 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-15.0.0_pre20241117-PR112556-c-Allow-bool-and-enum-null-pointer-constants.patch b/sys-devel/gcc/files/gcc-15.0.0_pre20241117-PR112556-c-Allow-bool-and-enum-null-pointer-constants.patch
new file mode 100644
index 000000000000..b17c1e04998c
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-15.0.0_pre20241117-PR112556-c-Allow-bool-and-enum-null-pointer-constants.patch
@@ -0,0 +1,244 @@
+From 3d525fce70fa0ffa0b22af6e213643e1ceca5ab5 Mon Sep 17 00:00:00 2001
+Message-ID: <3d525fce70fa0ffa0b22af6e213643e1ceca5ab5.1731987909.git.sam@gentoo.org>
+From: Joseph Myers <josmyers@redhat.com>
+Date: Mon, 18 Nov 2024 22:24:48 +0000
+Subject: [PATCH] c: Allow bool and enum null pointer constants [PR112556]
+
+As reported in bug 112556, GCC wrongly rejects conversion of null
+pointer constants with bool or enum type to pointers in
+convert_for_assignment (assignment, initialization, argument passing,
+return).  Fix the code there to allow BOOLEAN_TYPE and ENUMERAL_TYPE;
+it already allowed INTEGER_TYPE and BITINT_TYPE.
+
+This bug (together with -std=gnu23 meaning false has type bool rather
+than int) has in turn resulted in people thinking they need to fix
+code using false as a null pointer constant for C23 compatibility.
+While such a usage is certainly questionable, it has nothing to do
+with C23 compatibility and the right place for warnings about such
+usage is -Wzero-as-null-pointer-constant.  I think it would be
+appropriate to extend -Wzero-as-null-pointer-constant to cover
+BOOLEAN_TYPE, ENUMERAL_TYPE and BITINT_TYPE (in all the various
+contexts in which that option generates warnings), though this patch
+doesn't do anything about that option.
+
+Bootstrapped with no regressions for x86-64-pc-linux-gnu.
+
+	PR c/112556
+
+gcc/c/
+	* c-typeck.cc (convert_for_assignment): Allow conversion of
+	ENUMERAL_TYPE and BOOLEAN_TYPE null pointer constants to pointers.
+
+gcc/testsuite/
+	* gcc.dg/c11-null-pointer-constant-1.c,
+	gcc.dg/c23-null-pointer-constant-1.c: New tests.
+---
+ gcc/c/c-typeck.cc                             |   2 +
+ .../gcc.dg/c11-null-pointer-constant-1.c      |  55 ++++++++
+ .../gcc.dg/c23-null-pointer-constant-1.c      | 120 ++++++++++++++++++
+ 3 files changed, 177 insertions(+)
+ create mode 100644 gcc/testsuite/gcc.dg/c11-null-pointer-constant-1.c
+ create mode 100644 gcc/testsuite/gcc.dg/c23-null-pointer-constant-1.c
+
+diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
+index 26ee0ebf91f0..a701dd090fb8 100644
+--- a/gcc/c/c-typeck.cc
++++ b/gcc/c/c-typeck.cc
+@@ -8457,6 +8457,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
+     }
+   else if (codel == POINTER_TYPE
+ 	   && (coder == INTEGER_TYPE
++	       || coder == ENUMERAL_TYPE
++	       || coder == BOOLEAN_TYPE
+ 	       || coder == NULLPTR_TYPE
+ 	       || coder == BITINT_TYPE))
+     {
+diff --git a/gcc/testsuite/gcc.dg/c11-null-pointer-constant-1.c b/gcc/testsuite/gcc.dg/c11-null-pointer-constant-1.c
+new file mode 100644
+index 000000000000..f463a1a59da3
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/c11-null-pointer-constant-1.c
+@@ -0,0 +1,55 @@
++/* Test zero with different types as null pointer constant: bug 112556.  */
++/* { dg-do compile } */
++/* { dg-options "-std=c11 -pedantic-errors -Wno-pointer-compare" } */
++
++enum e { ZERO };
++
++void *p1 = 0;
++void *p2 = 0LL;
++void *p3 = (char) 0;
++void *p4 = 0UL;
++void *p5 = (_Bool) 0;
++void *p6 = (enum e) ZERO;
++
++void f (void *);
++
++void *
++g (void)
++{
++  p1 = 0;
++  p2 = 0LL;
++  p3 = (char) 0;
++  p4 = 0UL;
++  p5 = (_Bool) 0;
++  p6 = (enum e) ZERO;
++  f (0);
++  f (0ULL);
++  f (0L);
++  f ((char) 0);
++  f ((_Bool) 0);
++  f ((enum e) ZERO);
++  (1 ? p1 : 0);
++  (1 ? p1 : 0L);
++  (1 ? p1 : 0ULL);
++  (1 ? p1 : (char) 0);
++  (1 ? p1 : (_Bool) 0);
++  (1 ? p1 : (enum e) 0);
++  p1 == 0;
++  p1 == 0LL;
++  p1 == 0U;
++  p1 == (char) 0;
++  p1 == (_Bool) 0;
++  p1 == (enum e) 0;
++  p1 != 0;
++  p1 != 0LL;
++  p1 != 0U;
++  p1 != (char) 0;
++  p1 != (_Bool) 0;
++  p1 != (enum e) 0;
++  return 0;
++  return 0UL;
++  return 0LL;
++  return (char) 0;
++  return (_Bool) 0;
++  return (enum e) 0;
++}
+diff --git a/gcc/testsuite/gcc.dg/c23-null-pointer-constant-1.c b/gcc/testsuite/gcc.dg/c23-null-pointer-constant-1.c
+new file mode 100644
+index 000000000000..71b66cc35d6b
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/c23-null-pointer-constant-1.c
+@@ -0,0 +1,120 @@
++/* Test zero with different types as null pointer constant: bug 112556.  */
++/* { dg-do compile } */
++/* { dg-options "-std=c23 -pedantic-errors -Wno-pointer-compare" } */
++
++enum e { ZERO };
++enum e2 : bool { BZERO };
++enum e3 : long { LZERO };
++
++void *p1 = 0;
++void *p2 = 0LL;
++void *p3 = (char) 0;
++void *p4 = 0UL;
++void *p5 = (bool) 0;
++void *p6 = (enum e) ZERO;
++void *p7 = false;
++void *p8 = BZERO;
++void *p9 = (enum e2) 0;
++void *p10 = LZERO;
++void *p11 = (enum e3) 0;
++#ifdef __BITINT_MAXWIDTH__
++void *p12 = 0wb;
++void *p13 = 0uwb;
++#endif
++
++void f (void *);
++
++void *
++g (void)
++{
++  p1 = 0;
++  p2 = 0LL;
++  p3 = (char) 0;
++  p4 = 0UL;
++  p5 = (bool) 0;
++  p6 = (enum e) ZERO;
++  p7 = false;
++  p8 = BZERO;
++  p9 = (enum e2) 0;
++  p10 = LZERO;
++  p11 = (enum e3) 0;
++#ifdef __BITINT_MAXWIDTH__
++  p12 = 0wb;
++  p13 = 0uwb;
++#endif
++  f (0);
++  f (0ULL);
++  f (0L);
++  f ((char) 0);
++  f ((bool) 0);
++  f ((enum e) ZERO);
++  f (false);
++  f (BZERO);
++  f ((enum e2) 0);
++  f (LZERO);
++  f ((enum e3) 0);
++#ifdef __BITINT_MAXWIDTH__
++  f (0wb);
++  f (0uwb);
++#endif
++  (1 ? p1 : 0);
++  (1 ? p1 : 0L);
++  (1 ? p1 : 0ULL);
++  (1 ? p1 : (char) 0);
++  (1 ? p1 : (bool) 0);
++  (1 ? p1 : (enum e) 0);
++  (1 ? p1 : false);
++  (1 ? p1 : BZERO);
++  (1 ? p1 : (enum e2) 0);
++  (1 ? p1 : LZERO);
++  (1 ? p1 : (enum e3) 0);
++#ifdef __BITINT_MAXWIDTH__
++  (1 ? p1 : 0wb);
++  (1 ? p1 : 0uwb);
++#endif
++  p1 == 0;
++  p1 == 0LL;
++  p1 == 0U;
++  p1 == (char) 0;
++  p1 == (bool) 0;
++  p1 == (enum e) 0;
++  p1 == false;
++  p1 == BZERO;
++  p1 == (enum e2) 0;
++  p1 == LZERO;
++  p1 == (enum e3) 0;
++#ifdef __BITINT_MAXWIDTH__
++  p1 == 0wb;
++  p1 == 0uwb;
++#endif
++  p1 != 0;
++  p1 != 0LL;
++  p1 != 0U;
++  p1 != (char) 0;
++  p1 != (bool) 0;
++  p1 != (enum e) 0;
++  p1 != false;
++  p1 != BZERO;
++  p1 != (enum e2) 0;
++  p1 != LZERO;
++  p1 != (enum e3) 0;
++#ifdef __BITINT_MAXWIDTH__
++  p1 != 0wb;
++  p1 != 0uwb;
++#endif
++  return 0;
++  return 0UL;
++  return 0LL;
++  return (char) 0;
++  return (bool) 0;
++  return (enum e) 0;
++  return false;
++  return BZERO;
++  return (enum e2) 0;
++  return LZERO;
++  return (enum e3) 0;
++#ifdef __BITINT_MAXWIDTH__
++  return 0wb;
++  return 0uwb;
++#endif
++}
+-- 
+2.47.0

diff --git a/sys-devel/gcc/gcc-15.0.0_pre20241117-r2.ebuild b/sys-devel/gcc/gcc-15.0.0_pre20241117-r2.ebuild
new file mode 100644
index 000000000000..ee327823124e
--- /dev/null
+++ b/sys-devel/gcc/gcc-15.0.0_pre20241117-r2.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+TOOLCHAIN_PATCH_DEV="sam"
+TOOLCHAIN_HAS_TESTS=1
+PATCH_GCC_VER="15.0.0"
+PATCH_VER="26"
+MUSL_VER="2"
+MUSL_GCC_VER="15.0.0"
+PYTHON_COMPAT=( python3_{10..12} )
+
+if [[ -n ${TOOLCHAIN_GCC_RC} ]] ; then
+	# Cheesy hack for RCs
+	MY_PV=$(ver_cut 1).$((($(ver_cut 2) + 1))).$((($(ver_cut 3) - 1)))-RC-$(ver_cut 5)
+	MY_P=${PN}-${MY_PV}
+	GCC_TARBALL_SRC_URI="mirror://gcc/snapshots/${MY_PV}/${MY_P}.tar.xz"
+	TOOLCHAIN_SET_S=no
+	S="${WORKDIR}"/${MY_P}
+fi
+
+inherit toolchain
+
+if tc_is_live ; then
+	# Needs to be after inherit (for now?), bug #830908
+	EGIT_BRANCH=master
+elif [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+	# Don't keyword live ebuilds
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	:;
+fi
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
+	# If GCC is enabling CET by default, we need glibc to be built with support for it.
+	# bug #830454
+	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
+	DEPEND="${RDEPEND}"
+fi
+
+src_prepare() {
+	local p upstreamed_patches=(
+		# add them here
+	)
+	for p in "${upstreamed_patches[@]}"; do
+		rm -v "${WORKDIR}/patch/${p}" || die
+	done
+
+	toolchain_src_prepare
+
+	eapply "${FILESDIR}"/${P}-PR112556-c-Allow-bool-and-enum-null-pointer-constants.patch
+	eapply_user
+}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2024-06-25  0:11 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2024-06-25  0:11 UTC (permalink / raw
  To: gentoo-commits

commit:     a8b652d02e5d53c11e7a5a0c792bac7e8f5174e9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 25 00:09:45 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun 25 00:10:03 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8b652d0

sys-devel/gcc: backport ICE fix for 15

Bug: https://gcc.gnu.org/PR115602
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/gcc-15.0.0_pre20240623-PR115602.patch    | 120 +++++++++++++++++++++
 ...623.ebuild => gcc-15.0.0_pre20240623-r1.ebuild} |   1 +
 2 files changed, 121 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-15.0.0_pre20240623-PR115602.patch b/sys-devel/gcc/files/gcc-15.0.0_pre20240623-PR115602.patch
new file mode 100644
index 000000000000..d78c6d964906
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-15.0.0_pre20240623-PR115602.patch
@@ -0,0 +1,120 @@
+https://gcc.gnu.org/PR115602
+https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=c43c74f6ec795a586388de7abfdd20a0040f6f16
+
+From c43c74f6ec795a586388de7abfdd20a0040f6f16 Mon Sep 17 00:00:00 2001
+From: Richard Biener <rguenther@suse.de>
+Date: Mon, 24 Jun 2024 09:52:39 +0200
+Subject: [PATCH] tree-optimization/115602 - SLP CSE results in cycles
+
+The following prevents SLP CSE to create new cycles which happened
+because of a 1:1 permute node being present where its child was then
+CSEd to the permute node.  Fixed by making a node only available to
+CSE to after recursing.
+
+	PR tree-optimization/115602
+	* tree-vect-slp.cc (vect_cse_slp_nodes): Delay populating the
+	bst-map to avoid cycles.
+
+	* gcc.dg/vect/pr115602.c: New testcase.
+---
+ gcc/testsuite/gcc.dg/vect/pr115602.c | 27 +++++++++++++++++++++++
+ gcc/tree-vect-slp.cc                 | 33 ++++++++++++++++++----------
+ 2 files changed, 48 insertions(+), 12 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/vect/pr115602.c
+
+diff --git a/gcc/testsuite/gcc.dg/vect/pr115602.c b/gcc/testsuite/gcc.dg/vect/pr115602.c
+new file mode 100644
+index 00000000000..9a208d1d950
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/vect/pr115602.c
+@@ -0,0 +1,27 @@
++/* { dg-do compile } */
++
++typedef struct {
++  double x, y;
++} pointf;
++struct {
++  pointf focus;
++  double zoom;
++  pointf devscale;
++  char button;
++  pointf oldpointer;
++} gvevent_motion_job;
++char gvevent_motion_job_4;
++double gvevent_motion_pointer_1, gvevent_motion_pointer_0;
++void gvevent_motion() {
++  double dx = (gvevent_motion_pointer_0 - gvevent_motion_job.oldpointer.x) /
++              gvevent_motion_job.devscale.x,
++         dy = (gvevent_motion_pointer_1 - gvevent_motion_job.oldpointer.y) /
++              gvevent_motion_job.devscale.y;
++  if (dx && dy < .0001)
++    return;
++  switch (gvevent_motion_job_4)
++  case 2: {
++    gvevent_motion_job.focus.x -= dy / gvevent_motion_job.zoom;
++    gvevent_motion_job.focus.y += dx / gvevent_motion_job.zoom;
++  }
++}
+diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
+index e84aeabef94..b47b7e8c979 100644
+--- a/gcc/tree-vect-slp.cc
++++ b/gcc/tree-vect-slp.cc
+@@ -6079,35 +6079,44 @@ vect_optimize_slp_pass::run ()
+ static void
+ vect_cse_slp_nodes (scalar_stmts_to_slp_tree_map_t *bst_map, slp_tree& node)
+ {
++  bool put_p = false;
+   if (SLP_TREE_DEF_TYPE (node) == vect_internal_def
+       /* Besides some VEC_PERM_EXPR, two-operator nodes also
+ 	 lack scalar stmts and thus CSE doesn't work via bst_map.  Ideally
+ 	 we'd have sth that works for all internal and external nodes.  */
+       && !SLP_TREE_SCALAR_STMTS (node).is_empty ())
+     {
+-      if (slp_tree *leader = bst_map->get (SLP_TREE_SCALAR_STMTS (node)))
++      slp_tree *leader = bst_map->get (SLP_TREE_SCALAR_STMTS (node));
++      if (leader)
+ 	{
+-	  if (*leader != node)
+-	    {
+-	      if (dump_enabled_p ())
+-		dump_printf_loc (MSG_NOTE, vect_location,
+-				 "re-using SLP tree %p for %p\n",
+-				 (void *)*leader, (void *)node);
+-	      vect_free_slp_tree (node);
+-	      (*leader)->refcnt += 1;
+-	      node = *leader;
+-	    }
++	  /* We've visited this node already.  */
++	  if (!*leader || *leader == node)
++	    return;
++
++	  if (dump_enabled_p ())
++	    dump_printf_loc (MSG_NOTE, vect_location,
++			     "re-using SLP tree %p for %p\n",
++			     (void *)*leader, (void *)node);
++	  vect_free_slp_tree (node);
++	  (*leader)->refcnt += 1;
++	  node = *leader;
+ 	  return;
+ 	}
+ 
+-      bst_map->put (SLP_TREE_SCALAR_STMTS (node).copy (), node);
++      /* Avoid creating a cycle by populating the map only after recursion.  */
++      bst_map->put (SLP_TREE_SCALAR_STMTS (node).copy (), nullptr);
+       node->refcnt += 1;
++      put_p = true;
+       /* And recurse.  */
+     }
+ 
+   for (slp_tree &child : SLP_TREE_CHILDREN (node))
+     if (child)
+       vect_cse_slp_nodes (bst_map, child);
++
++  /* Now record the node for CSE in other siblings.  */
++  if (put_p)
++    bst_map->put (SLP_TREE_SCALAR_STMTS (node).copy (), node);
+ }
+ 
+ /* Optimize the SLP graph of VINFO.  */
+-- 
+2.43.0

diff --git a/sys-devel/gcc/gcc-15.0.0_pre20240623.ebuild b/sys-devel/gcc/gcc-15.0.0_pre20240623-r1.ebuild
similarity index 97%
rename from sys-devel/gcc/gcc-15.0.0_pre20240623.ebuild
rename to sys-devel/gcc/gcc-15.0.0_pre20240623-r1.ebuild
index b2ef3b0ac50b..0bfd8a8fe85d 100644
--- a/sys-devel/gcc/gcc-15.0.0_pre20240623.ebuild
+++ b/sys-devel/gcc/gcc-15.0.0_pre20240623-r1.ebuild
@@ -49,5 +49,6 @@ src_prepare() {
 
 	toolchain_src_prepare
 
+	eapply "${FILESDIR}"/${P}-PR115602.patch
 	eapply_user
 }


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2024-03-07 18:37 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2024-03-07 18:37 UTC (permalink / raw
  To: gentoo-commits

commit:     e4dfb164264174461dd6ac8a826fb01b00e5dbf8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Mar  7 18:36:18 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Mar  7 18:36:18 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4dfb164

Revert "sys-devel/gcc: drop obsolete cross fixincludes patch for 13"

This reverts commit 456eee6e374b50a4d9108a642ca29c5573ac5cb8.

Restore the fixincludes revert. The situation has improved a bit though,
because we now only run fixincludes when it's truly needed, so having
this patch is less risky to begin with.

Caveat emptor for trying to remove this in future: make sure to test
clean builds without mingw already built, and with.

Bug: https://bugs.gentoo.org/905118
Bug: https://bugs.gentoo.org/925204
Closes: https://bugs.gentoo.org/926059
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../gcc/files/gcc-13-fix-cross-fixincludes.patch      | 19 +++++++++++++++++++
 sys-devel/gcc/gcc-12.3.1_p20240223.ebuild             |  1 +
 sys-devel/gcc/gcc-12.3.1_p20240301.ebuild             |  1 +
 sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild          |  1 +
 sys-devel/gcc/gcc-13.2.1_p20240210.ebuild             |  1 +
 sys-devel/gcc/gcc-13.2.1_p20240224.ebuild             |  1 +
 sys-devel/gcc/gcc-13.2.1_p20240302.ebuild             |  1 +
 sys-devel/gcc/gcc-14.0.1_pre20240225.ebuild           |  1 +
 sys-devel/gcc/gcc-14.0.1_pre20240303-r1.ebuild        |  1 +
 9 files changed, 27 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
new file mode 100644
index 000000000000..e4abe01a0830
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
@@ -0,0 +1,19 @@
+Revert of https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=59e4c98173a79fcaa2c33253261409f38856c384
+for now to fix cross fixincludes builds.
+
+https://bugs.gentoo.org/905118
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -532,11 +532,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
+ # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
+ NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
+ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
+-ifeq (@includedir@,$(prefix)/include)
+-  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+-else
+-  CROSS_SYSTEM_HEADER_DIR = @includedir@
+-endif
++CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+ 
+ # autoconf sets SYSTEM_HEADER_DIR to one of the above.
+ # Purge it of unnecessary internal relative paths

diff --git a/sys-devel/gcc/gcc-12.3.1_p20240223.ebuild b/sys-devel/gcc/gcc-12.3.1_p20240223.ebuild
index 6a9137e1c84d..6a09eedbf172 100644
--- a/sys-devel/gcc/gcc-12.3.1_p20240223.ebuild
+++ b/sys-devel/gcc/gcc-12.3.1_p20240223.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
 	toolchain_src_prepare
 
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-12.3.1_p20240301.ebuild b/sys-devel/gcc/gcc-12.3.1_p20240301.ebuild
index 6a9137e1c84d..6a09eedbf172 100644
--- a/sys-devel/gcc/gcc-12.3.1_p20240301.ebuild
+++ b/sys-devel/gcc/gcc-12.3.1_p20240301.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
 	toolchain_src_prepare
 
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild b/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
index 3404c76c9248..7b1015f0e7cd 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
 	toolchain_src_prepare
 
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild b/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild
index 865959900de6..012b57185a8a 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
 	toolchain_src_prepare
 
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240224.ebuild b/sys-devel/gcc/gcc-13.2.1_p20240224.ebuild
index c4394cbaa0e9..dfdf0151adad 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240224.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240224.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
 	toolchain_src_prepare
 
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240302.ebuild b/sys-devel/gcc/gcc-13.2.1_p20240302.ebuild
index c4394cbaa0e9..dfdf0151adad 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240302.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240302.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
 	toolchain_src_prepare
 
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-14.0.1_pre20240225.ebuild b/sys-devel/gcc/gcc-14.0.1_pre20240225.ebuild
index 07ffb3cbdbe1..4b44c53c818f 100644
--- a/sys-devel/gcc/gcc-14.0.1_pre20240225.ebuild
+++ b/sys-devel/gcc/gcc-14.0.1_pre20240225.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
 	toolchain_src_prepare
 
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-14.0.1_pre20240303-r1.ebuild b/sys-devel/gcc/gcc-14.0.1_pre20240303-r1.ebuild
index ddfe33a42323..d864e654f957 100644
--- a/sys-devel/gcc/gcc-14.0.1_pre20240303-r1.ebuild
+++ b/sys-devel/gcc/gcc-14.0.1_pre20240303-r1.ebuild
@@ -61,5 +61,6 @@ src_prepare() {
 	toolchain_src_prepare
 
 	eapply "${FILESDIR}"/${P}-uninit.patch
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2024-02-19  5:06 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2024-02-19  5:06 UTC (permalink / raw
  To: gentoo-commits

commit:     456eee6e374b50a4d9108a642ca29c5573ac5cb8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 19 05:05:19 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 19 05:05:36 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=456eee6e

sys-devel/gcc: drop obsolete cross fixincludes patch for 13

We should be able to do this now after 0b75d3ce0bae8240c28c6a8f191f5130548f8475.

Bug: https://bugs.gentoo.org/905118
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../gcc/files/gcc-13-fix-cross-fixincludes.patch      | 19 -------------------
 sys-devel/gcc/gcc-13.2.1_p20230826.ebuild             |  3 +--
 sys-devel/gcc/gcc-13.2.1_p20231216.ebuild             |  3 +--
 sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild          |  1 -
 sys-devel/gcc/gcc-13.2.1_p20240120.ebuild             |  1 -
 sys-devel/gcc/gcc-13.2.1_p20240127.ebuild             |  1 -
 sys-devel/gcc/gcc-13.2.1_p20240203.ebuild             |  1 -
 sys-devel/gcc/gcc-13.2.1_p20240210.ebuild             |  1 -
 sys-devel/gcc/gcc-13.2.1_p20240217.ebuild             |  1 -
 9 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
deleted file mode 100644
index e4abe01a0830..000000000000
--- a/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Revert of https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=59e4c98173a79fcaa2c33253261409f38856c384
-for now to fix cross fixincludes builds.
-
-https://bugs.gentoo.org/905118
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -532,11 +532,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
- # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
- NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
- # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
--ifeq (@includedir@,$(prefix)/include)
--  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
--else
--  CROSS_SYSTEM_HEADER_DIR = @includedir@
--endif
-+CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
- 
- # autoconf sets SYSTEM_HEADER_DIR to one of the above.
- # Purge it of unnecessary internal relative paths

diff --git a/sys-devel/gcc/gcc-13.2.1_p20230826.ebuild b/sys-devel/gcc/gcc-13.2.1_p20230826.ebuild
index b764492f9a87..55c73d734d7b 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20230826.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20230826.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -60,6 +60,5 @@ src_prepare() {
 
 	toolchain_src_prepare
 
-	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20231216.ebuild b/sys-devel/gcc/gcc-13.2.1_p20231216.ebuild
index a6c1746943ea..3032d482a760 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20231216.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20231216.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -60,6 +60,5 @@ src_prepare() {
 
 	toolchain_src_prepare
 
-	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild b/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
index 7b1015f0e7cd..3404c76c9248 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
@@ -60,6 +60,5 @@ src_prepare() {
 
 	toolchain_src_prepare
 
-	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240120.ebuild b/sys-devel/gcc/gcc-13.2.1_p20240120.ebuild
index e295e327ec92..68348986bd19 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240120.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240120.ebuild
@@ -60,6 +60,5 @@ src_prepare() {
 
 	toolchain_src_prepare
 
-	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240127.ebuild b/sys-devel/gcc/gcc-13.2.1_p20240127.ebuild
index e295e327ec92..68348986bd19 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240127.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240127.ebuild
@@ -60,6 +60,5 @@ src_prepare() {
 
 	toolchain_src_prepare
 
-	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240203.ebuild b/sys-devel/gcc/gcc-13.2.1_p20240203.ebuild
index e295e327ec92..68348986bd19 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240203.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240203.ebuild
@@ -60,6 +60,5 @@ src_prepare() {
 
 	toolchain_src_prepare
 
-	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild b/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild
index aca4b7984086..e9961215dc32 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild
@@ -60,6 +60,5 @@ src_prepare() {
 
 	toolchain_src_prepare
 
-	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240217.ebuild b/sys-devel/gcc/gcc-13.2.1_p20240217.ebuild
index 1496205dad81..208fc6756f12 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240217.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240217.ebuild
@@ -60,6 +60,5 @@ src_prepare() {
 
 	toolchain_src_prepare
 
-	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2023-10-18 19:33 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2023-10-18 19:33 UTC (permalink / raw
  To: gentoo-commits

commit:     4e374e155734766b5682992ca22c77aef9de1220
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 18 19:33:33 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 18 19:33:40 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e374e15

sys-devel/gcc: backport pycryptodome ICE fix to 14.0.0_pre20231015

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../gcc-14.0.0_pre20231015-pycryptodome-ice.patch  | 212 +++++++++++++++++++++
 sys-devel/gcc/gcc-14.0.0_pre20231015-r1.ebuild     |  65 +++++++
 2 files changed, 277 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-14.0.0_pre20231015-pycryptodome-ice.patch b/sys-devel/gcc/files/gcc-14.0.0_pre20231015-pycryptodome-ice.patch
new file mode 100644
index 000000000000..377f68511f78
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-14.0.0_pre20231015-pycryptodome-ice.patch
@@ -0,0 +1,212 @@
+https://gcc.gnu.org/PR111845
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f1744dd50bb1661c98b694ff907cb0a1be4f6134
+
+From f1744dd50bb1661c98b694ff907cb0a1be4f6134 Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Wed, 18 Oct 2023 12:37:40 +0200
+Subject: [PATCH] tree-ssa-math-opts: Fix up match_uaddc_usubc [PR111845]
+
+GCC ICEs on the first testcase.  Successful match_uaddc_usubc ends up with
+some dead stmts which DCE will remove (hopefully) later all.
+The ICE is because one of the dead stmts refers to a freed SSA_NAME.
+The code already gsi_removes a couple of stmts in the
+  /* Remove some statements which can't be kept in the IL because they
+     use SSA_NAME whose setter is going to be removed too.  */
+section for the same reason (the reason for the freed SSA_NAMEs is that
+we don't really have a replacement for those cases - all we have after
+a match is combined overflow from the addition/subtraction of 2 operands + a
+[0, 1] carry in, but not the individual overflows from the former 2
+additions), but for the last (most significant) limb case, where we try
+to match x = op1 + op2 + carry1 + carry2; or
+x = op1 - op2 - carry1 - carry2; we just gsi_replace the final stmt, but
+left around the 2 temporary stmts as dead; if we were unlucky enough that
+those referenced the carry flag that went away, it ICEs.
+
+So, the following patch remembers those temporary statements (rather than
+trying to rediscover them more expensively) and removes them before the
+final one is replaced.
+
+While working on it, I've noticed we didn't support all the reassociated
+possibilities of writing the addition of 4 operands or subtracting 3
+operands from one, we supported e.g.
+x = ((op1 + op2) + op3) + op4;
+x = op1 + ((op2 + op3) + op4);
+but not
+x = (op1 + (op2 + op3)) + op4;
+x = op1 + (op2 + (op3 + op4));
+Fixed by the change to inspect also rhs[2] when rhs[1] didn't yield what
+we were searching for (if non-NULL) - rhs[0] is inspected in the first
+loop and has different handling for the MINUS_EXPR case.
+
+2023-10-18  Jakub Jelinek  <jakub@redhat.com>
+
+	PR tree-optimization/111845
+	* tree-ssa-math-opts.cc (match_uaddc_usubc): Remember temporary
+	statements for the 4 operand addition or subtraction of 3 operands
+	from 1 operand cases and remove them when successful.  Look for
+	nested additions even from rhs[2], not just rhs[1].
+
+	* gcc.dg/pr111845.c: New test.
+	* gcc.target/i386/pr111845.c: New test.
+---
+ gcc/testsuite/gcc.dg/pr111845.c          | 16 ++++++++
+ gcc/testsuite/gcc.target/i386/pr111845.c | 47 +++++++++++++++++++++++
+ gcc/tree-ssa-math-opts.cc                | 48 +++++++++++++++---------
+ 3 files changed, 94 insertions(+), 17 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/pr111845.c
+ create mode 100644 gcc/testsuite/gcc.target/i386/pr111845.c
+
+diff --git a/gcc/testsuite/gcc.dg/pr111845.c b/gcc/testsuite/gcc.dg/pr111845.c
+new file mode 100644
+index 000000000000..1bcb4f88e6f1
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/pr111845.c
+@@ -0,0 +1,16 @@
++/* PR tree-optimization/111845 */
++/* { dg-do compile } */
++/* { dg-options "-O2 --param tree-reassoc-width=2" } */
++
++int a, b;
++unsigned int c, d, e;
++
++void
++foo (int x)
++{
++  b += d;
++  c += b < d;
++  b += e = a < x;
++  c += b;
++  c += b < e;
++}
+diff --git a/gcc/testsuite/gcc.target/i386/pr111845.c b/gcc/testsuite/gcc.target/i386/pr111845.c
+new file mode 100644
+index 000000000000..d52110a40422
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/pr111845.c
+@@ -0,0 +1,47 @@
++/* PR tree-optimization/111845 */
++/* { dg-do compile } */
++/* { dg-options "-O2 -g -masm=att" } */
++/* { dg-final { scan-assembler-times "\tadcq\t" 8 { target lp64 } } } */
++/* { dg-final { scan-assembler-times "\tadcl\t" 8 { target ia32 } } } */
++
++unsigned long l, m;
++
++__attribute__((noipa)) void
++foo (unsigned long x, unsigned long y, unsigned long h, unsigned long i, int a, int b)
++{
++  unsigned long c, d;
++  unsigned long e = __builtin_add_overflow (x, y, &c);
++  unsigned long f = __builtin_add_overflow (c, a < b, &d);
++  m = ((h + i) + e) + f;
++  l = d;
++}
++
++__attribute__((noipa)) void
++bar (unsigned long x, unsigned long y, unsigned long h, unsigned long i, int a, int b)
++{
++  unsigned long c, d;
++  unsigned long e = __builtin_add_overflow (x, y, &c);
++  unsigned long f = __builtin_add_overflow (c, a < b, &d);
++  m = (h + (i + e)) + f;
++  l = d;
++}
++
++__attribute__((noipa)) void
++baz (unsigned long x, unsigned long y, unsigned long h, unsigned long i, int a, int b)
++{
++  unsigned long c, d;
++  unsigned long e = __builtin_add_overflow (x, y, &c);
++  unsigned long f = __builtin_add_overflow (c, a < b, &d);
++  m = h + (i + (e + f));
++  l = d;
++}
++
++__attribute__((noipa)) void
++qux (unsigned long x, unsigned long y, unsigned long h, unsigned long i, int a, int b)
++{
++  unsigned long c, d;
++  unsigned long e = __builtin_add_overflow (x, y, &c);
++  unsigned long f = __builtin_add_overflow (c, a < b, &d);
++  m = h + ((i + e) + f);
++  l = d;
++}
+diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc
+index 51c14d6bad9f..363f31646691 100644
+--- a/gcc/tree-ssa-math-opts.cc
++++ b/gcc/tree-ssa-math-opts.cc
+@@ -4581,6 +4581,7 @@ match_uaddc_usubc (gimple_stmt_iterator *gsi, gimple *stmt, tree_code code)
+   if (!INTEGRAL_TYPE_P (type) || !TYPE_UNSIGNED (type))
+     return false;
+ 
++  auto_vec<gimple *, 2> temp_stmts;
+   if (code != BIT_IOR_EXPR && code != BIT_XOR_EXPR)
+     {
+       /* If overflow flag is ignored on the MSB limb, we can end up with
+@@ -4615,26 +4616,29 @@ match_uaddc_usubc (gimple_stmt_iterator *gsi, gimple *stmt, tree_code code)
+ 	      rhs[0] = gimple_assign_rhs1 (g);
+ 	      tree &r = rhs[2] ? rhs[3] : rhs[2];
+ 	      r = r2;
++	      temp_stmts.quick_push (g);
+ 	    }
+ 	  else
+ 	    break;
+ 	}
+-      while (TREE_CODE (rhs[1]) == SSA_NAME && !rhs[3])
+-	{
+-	  gimple *g = SSA_NAME_DEF_STMT (rhs[1]);
+-	  if (has_single_use (rhs[1])
+-	      && is_gimple_assign (g)
+-	      && gimple_assign_rhs_code (g) == PLUS_EXPR)
+-	    {
+-	      rhs[1] = gimple_assign_rhs1 (g);
+-	      if (rhs[2])
+-		rhs[3] = gimple_assign_rhs2 (g);
+-	      else
+-		rhs[2] = gimple_assign_rhs2 (g);
+-	    }
+-	  else
+-	    break;
+-	}
++      for (int i = 1; i <= 2; ++i)
++	while (rhs[i] && TREE_CODE (rhs[i]) == SSA_NAME && !rhs[3])
++	  {
++	    gimple *g = SSA_NAME_DEF_STMT (rhs[i]);
++	    if (has_single_use (rhs[i])
++		&& is_gimple_assign (g)
++		&& gimple_assign_rhs_code (g) == PLUS_EXPR)
++	      {
++		rhs[i] = gimple_assign_rhs1 (g);
++		if (rhs[2])
++		  rhs[3] = gimple_assign_rhs2 (g);
++		else
++		  rhs[2] = gimple_assign_rhs2 (g);
++		temp_stmts.quick_push (g);
++	      }
++	    else
++	      break;
++	  }
+       /* If there are just 3 addends or one minuend and two subtrahends,
+ 	 check for UADDC or USUBC being pattern recognized earlier.
+ 	 Say r = op1 + op2 + ovf1 + ovf2; where the (ovf1 + ovf2) part
+@@ -5039,7 +5043,17 @@ match_uaddc_usubc (gimple_stmt_iterator *gsi, gimple *stmt, tree_code code)
+   g = gimple_build_assign (ilhs, IMAGPART_EXPR,
+ 			   build1 (IMAGPART_EXPR, TREE_TYPE (ilhs), nlhs));
+   if (rhs[2])
+-    gsi_insert_before (gsi, g, GSI_SAME_STMT);
++    {
++      gsi_insert_before (gsi, g, GSI_SAME_STMT);
++      /* Remove some further statements which can't be kept in the IL because
++	 they can use SSA_NAMEs whose setter is going to be removed too.  */
++      while (temp_stmts.length ())
++	{
++	  g = temp_stmts.pop ();
++	  gsi2 = gsi_for_stmt (g);
++	  gsi_remove (&gsi2, true);
++	}
++    }
+   else
+     gsi_replace (gsi, g, true);
+   /* Remove some statements which can't be kept in the IL because they
+-- 
+2.39.3

diff --git a/sys-devel/gcc/gcc-14.0.0_pre20231015-r1.ebuild b/sys-devel/gcc/gcc-14.0.0_pre20231015-r1.ebuild
new file mode 100644
index 000000000000..3e4f9224d3e3
--- /dev/null
+++ b/sys-devel/gcc/gcc-14.0.0_pre20231015-r1.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+TOOLCHAIN_PATCH_DEV="sam"
+PATCH_GCC_VER="14.0.0"
+PATCH_VER="4"
+MUSL_VER="1"
+MUSL_GCC_VER="14.0.0"
+
+if [[ ${PV} == *.9999 ]] ; then
+	MY_PV_2=$(ver_cut 2)
+	MY_PV_3=1
+	if [[ ${MY_PV_2} == 0 ]] ; then
+		MY_PV_2=0
+		MY_PV_3=0
+	else
+		MY_PV_2=$((${MY_PV_2} - 1))
+	fi
+
+	# e.g. 12.2.9999 -> 12.1.1
+	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.${MY_PV_3}
+elif [[ -n ${TOOLCHAIN_GCC_RC} ]] ; then
+	# Cheesy hack for RCs
+	MY_PV=$(ver_cut 1).$((($(ver_cut 2) + 1))).$((($(ver_cut 3) - 1)))-RC-$(ver_cut 5)
+	MY_P=${PN}-${MY_PV}
+	GCC_TARBALL_SRC_URI="mirror://gcc/snapshots/${MY_PV}/${MY_P}.tar.xz"
+	TOOLCHAIN_SET_S=no
+	S="${WORKDIR}"/${MY_P}
+fi
+
+inherit toolchain
+
+if tc_is_live ; then
+	# Needs to be after inherit (for now?), bug #830908
+	EGIT_BRANCH=master
+elif [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+	# Don't keyword live ebuilds
+	#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	:;
+fi
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
+	# If GCC is enabling CET by default, we need glibc to be built with support for it.
+	# bug #830454
+	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
+	DEPEND="${RDEPEND}"
+	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
+fi
+
+src_prepare() {
+	local p upstreamed_patches=(
+		# add them here
+	)
+	for p in "${upstreamed_patches[@]}"; do
+		rm -v "${WORKDIR}/patch/${p}" || die
+	done
+
+	toolchain_src_prepare
+
+	eapply "${FILESDIR}"/${P}-pycryptodome-ice.patch
+	eapply_user
+}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2023-05-16  6:07 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2023-05-16  6:07 UTC (permalink / raw
  To: gentoo-commits

commit:     0290ec871c3c59716cdf7718bbee1cef1b86ec43
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue May 16 06:07:12 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue May 16 06:07:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0290ec87

sys-devel/gcc: backport ccache ICE fix for 12.3*

Bug: https://bugs.gentoo.org/906310
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/gcc/files/gcc-12.3-ccache-ICE.patch | 67 +++++++++++++++++++++++++++
 sys-devel/gcc/gcc-12.3.1_p20230512-r1.ebuild  | 57 +++++++++++++++++++++++
 2 files changed, 124 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-12.3-ccache-ICE.patch b/sys-devel/gcc/files/gcc-12.3-ccache-ICE.patch
new file mode 100644
index 000000000000..9a170f5db77e
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-12.3-ccache-ICE.patch
@@ -0,0 +1,67 @@
+https://bugs.gentoo.org/906310
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109850
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109241
+
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=396a4e76afec30d2461638f569cae18955eb4ad2
+
+From 396a4e76afec30d2461638f569cae18955eb4ad2 Mon Sep 17 00:00:00 2001
+From: Jason Merrill <jason@redhat.com>
+Date: Wed, 22 Mar 2023 16:11:47 -0400
+Subject: [PATCH] c++: local class in nested generic lambda [PR109241]
+
+In this testcase, the tree walk to look for bare parameter packs was
+confused by finding a type with no TREE_BINFO.  But it should be fine that
+it's unset; we already checked for unexpanded packs at parse time.
+
+I also tried doing the partial instantiation of the local class, which is
+probably the long-term direction we want to go, but for stage 4 let's go
+with this safer change.
+
+	PR c++/109241
+
+gcc/cp/ChangeLog:
+
+	* pt.cc (find_parameter_packs_r): Handle null TREE_BINFO.
+
+gcc/testsuite/ChangeLog:
+
+	* g++.dg/cpp1y/lambda-generic-local-class2.C: New test.
+--- a/gcc/cp/pt.cc
++++ b/gcc/cp/pt.cc
+@@ -4106,10 +4106,14 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
+     case TAG_DEFN:
+       t = TREE_TYPE (t);
+       if (CLASS_TYPE_P (t))
+-	/* Local class, need to look through the whole definition.  */
+-	for (tree bb : BINFO_BASE_BINFOS (TYPE_BINFO (t)))
+-	  cp_walk_tree (&BINFO_TYPE (bb), &find_parameter_packs_r,
+-			ppd, ppd->visited);
++	{
++	  /* Local class, need to look through the whole definition.
++	     TYPE_BINFO might be unset for a partial instantiation.  */
++	  if (TYPE_BINFO (t))
++	    for (tree bb : BINFO_BASE_BINFOS (TYPE_BINFO (t)))
++	      cp_walk_tree (&BINFO_TYPE (bb), &find_parameter_packs_r,
++			    ppd, ppd->visited);
++	}
+       else
+ 	/* Enum, look at the values.  */
+ 	for (tree l = TYPE_VALUES (t); l; l = TREE_CHAIN (l))
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class2.C
+@@ -0,0 +1,13 @@
++// PR c++/109241
++// { dg-do compile { target c++14 } }
++// { dg-options "" } no pedantic
++
++void g() {
++  [](auto) {
++    [](auto) {
++      ({
++        struct A {};
++      });
++    };
++  }(1);
++}
+-- 
+2.31.1

diff --git a/sys-devel/gcc/gcc-12.3.1_p20230512-r1.ebuild b/sys-devel/gcc/gcc-12.3.1_p20230512-r1.ebuild
new file mode 100644
index 000000000000..922e86050a50
--- /dev/null
+++ b/sys-devel/gcc/gcc-12.3.1_p20230512-r1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+TOOLCHAIN_PATCH_DEV="sam"
+PATCH_VER="2"
+PATCH_GCC_VER="12.3.0"
+MUSL_VER="1"
+MUSL_GCC_VER="12.3.0"
+
+if [[ $(ver_cut 3) == 9999 ]] ; then
+	MY_PV_2=$(ver_cut 2)
+	if [[ ${MY_PV_2} == 0 ]] ; then
+		MY_PV_2=0
+	else
+		MY_PV_2=$(($(ver_cut 2) - 1))
+	fi
+
+	# e.g. 12.2.9999 -> 12.1.1
+	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.$(($(ver_cut 3) - 9998))
+elif [[ -n ${TOOLCHAIN_GCC_RC} ]] ; then
+	# Cheesy hack for RCs
+	# Sometimes the RCs are e.g. 12.3 and not 12.3.0...
+	#MY_PV=$(ver_cut 1).$((($(ver_cut 2) + 1))).$((($(ver_cut 3) - 1)))-RC-$(ver_cut 5)
+	MY_PV=$(ver_cut 1).$((($(ver_cut 2) + 1)))-RC-$(ver_cut 5)
+	MY_P=${PN}-${MY_PV}
+	GCC_TARBALL_SRC_URI="mirror://gcc/snapshots/${MY_PV}/${MY_P}.tar.xz"
+	TOOLCHAIN_SET_S=no
+	S="${WORKDIR}"/${MY_P}
+fi
+
+inherit toolchain
+
+# Needs to be after inherit (for now?), bug #830908
+EGIT_BRANCH=releases/gcc-$(ver_cut 1)
+
+# Don't keyword live ebuilds
+#if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+#fi
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
+	# If GCC is enabling CET by default, we need glibc to be built with support for it.
+	# bug #830454
+	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
+	DEPEND="${RDEPEND}"
+	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
+fi
+
+src_prepare() {
+	toolchain_src_prepare
+
+	eapply "${FILESDIR}"/${PN}-12.3-ccache-ICE.patch
+	eapply_user
+}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2023-05-03 12:32 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2023-05-03 12:32 UTC (permalink / raw
  To: gentoo-commits

commit:     1e10614cf5b563340143230bae47c10c45300196
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed May  3 12:31:04 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May  3 12:31:04 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e10614c

sys-devel/gcc: backport libstdc++ UB fix for 13

May keyword this version later or may wait until next snapshot in a few days,
we'll see.

Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109703
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../gcc/files/gcc-13-PR109703-unreachable.patch    | 54 +++++++++++++++++++
 sys-devel/gcc/gcc-13.1.1_p20230429-r1.ebuild       | 63 ++++++++++++++++++++++
 2 files changed, 117 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13-PR109703-unreachable.patch b/sys-devel/gcc/files/gcc-13-PR109703-unreachable.patch
new file mode 100644
index 000000000000..f7c7c9f60a70
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13-PR109703-unreachable.patch
@@ -0,0 +1,54 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109703
+
+From d50f2599d7b23bdba05a9102645d082ed9bcb05f Mon Sep 17 00:00:00 2001
+From: Kefu Chai <kefu.chai@scylladb.com>
+Date: Mon, 1 May 2023 21:24:26 +0100
+Subject: [PATCH] libstdc++: Set _M_string_length before calling _M_dispose()
+ [PR109703]
+
+This always sets _M_string_length in the constructor for ranges of input
+iterators, such as stream iterators.
+
+We copy from the source range to the local buffer, and then repeatedly
+reallocate a larger one if necessary. When disposing the old buffer,
+_M_is_local() is used to tell if the buffer is the local one or not (and
+so must be deallocated). In addition to comparing the buffer address
+with the local buffer, _M_is_local() has an optimization hint so that
+the compiler knows that for a string using the local buffer, there is an
+invariant that _M_string_length <= _S_local_capacity (added for PR109299
+via r13-6915-gbf78b43873b0b7).  But we failed to set _M_string_length in
+the constructor taking a pair of iterators, so the invariant might not
+hold, and __builtin_unreachable() is reached. This causes UBsan errors,
+and potentially misoptimization.
+
+To ensure the invariant holds, _M_string_length is initialized to zero
+before doing anything else, so that _M_is_local() doesn't see an
+uninitialized value.
+
+This issue only surfaces when constructing a string with a range of
+input iterator, and the uninitialized _M_string_length happens to be
+greater than _S_local_capacity, i.e., 15 for the std::string
+specialization.
+
+libstdc++-v3/ChangeLog:
+
+	PR libstdc++/109703
+	* include/bits/basic_string.h (basic_string(Iter, Iter, Alloc)):
+	Initialize _M_string_length.
+
+Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
+Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
+(cherry picked from commit cbf6c7a1d16490a1e63e9a5ce00e9a5c44c4c2f2)
+--- a/libstdc++-v3/include/bits/basic_string.h
++++ b/libstdc++-v3/include/bits/basic_string.h
+@@ -760,7 +760,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
+ 	_GLIBCXX20_CONSTEXPR
+         basic_string(_InputIterator __beg, _InputIterator __end,
+ 		     const _Alloc& __a = _Alloc())
+-	: _M_dataplus(_M_local_data(), __a)
++	: _M_dataplus(_M_local_data(), __a), _M_string_length(0)
+ 	{
+ #if __cplusplus >= 201103L
+ 	  _M_construct(__beg, __end, std::__iterator_category(__beg));
+-- 
+2.31.1

diff --git a/sys-devel/gcc/gcc-13.1.1_p20230429-r1.ebuild b/sys-devel/gcc/gcc-13.1.1_p20230429-r1.ebuild
new file mode 100644
index 000000000000..9aa2b8645de1
--- /dev/null
+++ b/sys-devel/gcc/gcc-13.1.1_p20230429-r1.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+TOOLCHAIN_PATCH_DEV="sam"
+PATCH_VER="2"
+PATCH_GCC_VER="13.2.0"
+MUSL_VER="1"
+MUSL_GCC_VER="13.2.0"
+
+if [[ $(ver_cut 3) == 9999 ]] ; then
+	MY_PV_2=$(ver_cut 2)
+	if [[ ${MY_PV_2} == 0 ]] ; then
+		MY_PV_2=0
+	else
+		MY_PV_2=$(($(ver_cut 2) - 1))
+	fi
+
+	# e.g. 12.2.9999 -> 12.1.1
+	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.$(($(ver_cut 3) - 9998))
+elif [[ -n ${TOOLCHAIN_GCC_RC} ]] ; then
+	# Cheesy hack for RCs
+	MY_PV=$(ver_cut 1).$((($(ver_cut 2) + 1))).$((($(ver_cut 3) - 1)))-RC-$(ver_cut 5)
+	MY_P=${PN}-${MY_PV}
+	GCC_TARBALL_SRC_URI="mirror://gcc/snapshots/${MY_PV}/${MY_P}.tar.xz"
+	TOOLCHAIN_SET_S=no
+	S="${WORKDIR}"/${MY_P}
+fi
+
+inherit toolchain
+
+# Needs to be after inherit (for now?), bug #830908
+EGIT_BRANCH=releases/gcc-$(ver_cut 1)
+
+# Don't keyword live ebuilds
+#if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+#fi
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
+	# If GCC is enabling CET by default, we need glibc to be built with support for it.
+	# bug #830454
+	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
+	DEPEND="${RDEPEND}"
+	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
+fi
+
+src_prepare() {
+	local p upstreamed_patches=(
+		# add them here
+	)
+	for p in "${upstreamed_patches[@]}"; do
+		rm -v "${WORKDIR}/patch/${p}" || die
+	done
+
+	toolchain_src_prepare
+
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
+	eapply "${FILESDIR}"/${PN}-13-PR109703-unreachable.patch
+	eapply_user
+}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2023-04-26 14:14 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2023-04-26 14:14 UTC (permalink / raw
  To: gentoo-commits

commit:     79519252e88f8ad8c8ddf627ff9a473e99222e7b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 26 14:13:21 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr 26 14:13:56 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79519252

sys-devel/gcc: fix 13 cross builds w/ fixincludes

Add workaround for now.

Bug: https://bugs.gentoo.org/905118
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../gcc/files/gcc-13-fix-cross-fixincludes.patch      | 19 +++++++++++++++++++
 sys-devel/gcc/gcc-13.1.0-r1.ebuild                    |  1 +
 2 files changed, 20 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
new file mode 100644
index 000000000000..e4abe01a0830
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
@@ -0,0 +1,19 @@
+Revert of https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=59e4c98173a79fcaa2c33253261409f38856c384
+for now to fix cross fixincludes builds.
+
+https://bugs.gentoo.org/905118
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -532,11 +532,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
+ # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
+ NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
+ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
+-ifeq (@includedir@,$(prefix)/include)
+-  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+-else
+-  CROSS_SYSTEM_HEADER_DIR = @includedir@
+-endif
++CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+ 
+ # autoconf sets SYSTEM_HEADER_DIR to one of the above.
+ # Purge it of unnecessary internal relative paths

diff --git a/sys-devel/gcc/gcc-13.1.0-r1.ebuild b/sys-devel/gcc/gcc-13.1.0-r1.ebuild
index d55926f246f1..195b306ad1d2 100644
--- a/sys-devel/gcc/gcc-13.1.0-r1.ebuild
+++ b/sys-devel/gcc/gcc-13.1.0-r1.ebuild
@@ -57,5 +57,6 @@ src_prepare() {
 
 	toolchain_src_prepare
 
+	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
 	eapply_user
 }


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2023-04-17 12:05 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2023-04-17 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     57ab40882690719109d8ea0e989d6f0353472364
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 17 12:03:44 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr 17 12:03:48 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57ab4088

sys-devel/gcc: drop old 13 snapshots

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/gcc/Manifest                             |  1 -
 ...gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch | 63 ---------------------
 ...-clang-LocalizationChecker-ranger-any-PHI.patch | 46 ---------------
 ....1_pre20230409-PR109469-SLP-returns-twice.patch | 66 ----------------------
 ...pre20230409-PR109473-ICE-reduction-epilog.patch | 58 -------------------
 sys-devel/gcc/gcc-13.0.1_pre20230409-r1.ebuild     | 56 ------------------
 sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild     | 57 -------------------
 sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild     | 58 -------------------
 sys-devel/gcc/gcc-13.0.1_pre20230409-r4.ebuild     | 60 --------------------
 sys-devel/gcc/gcc-13.0.1_pre20230409.ebuild        | 56 ------------------
 10 files changed, 521 deletions(-)

diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index 3921631e9688..fdc8c8a0f9a1 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -27,7 +27,6 @@ DIST gcc-12.2.0-patches-10.tar.xz 14252 BLAKE2B 99368db982227728a6a9e2b1f694999f
 DIST gcc-12.2.0-patches-13.tar.xz 13756 BLAKE2B df0388a669458f2991951d2f4027badbff3f802e6a0422478206b5cdda76e70b531a474d2ac42817e9e7f8200e9ac35ca8276af539839b4ebb2e22903ec25a23 SHA512 2970de9d2806d59c5d0f77e66000860c816ebd674489db8114f48f6aa11575644154431480222580b520b9e312647b06f94ab38959a49a8cda818158d6babf1d
 DIST gcc-12.2.0-patches-14.tar.xz 13752 BLAKE2B c44609a8a3a96480f144b7e6859c2b1d7105f421ffa08929c35fc13eb5ec11d967b02cf8248ecb4ea85824b1872125a73c92f404050c3399d5c06fe668711fd3 SHA512 c1db7a7f3a929dfdc8de9a662448f57296ab818b9fd133763b2ab0dddce2e01cf322e5ac53f3d69c2366053ef3c4fa44c72eed248dc7aeef49f558341bdd3854
 DIST gcc-12.2.0.tar.xz 84645292 BLAKE2B 715574af9ad678f9dc8cfd19c866bf910c7edfd479e7e9681337feaa9b54e5d304ddb85483816b8d89754d502405823ae2eff0d1e444538763f40be8e428d8da SHA512 e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173
-DIST gcc-13-20230409.tar.xz 83942252 BLAKE2B 9fb394de80814c13f91ea1cc078e9ab5623576d67115f61b6090594d44ed9179445fe58fc35f509e9bfcc2c7305e8e111c24df4f2f62fe134eb24b09f7c15b7f SHA512 6b2fb29abf0ed77dcccd393d8ec0b8abc2d7aada0de6bab20eb561fd3f738c4b5023fb5598ffb017d10f099d597ddbc324a6dc71d5ed0119a7d9a7ef1faec1a1
 DIST gcc-13-20230416.tar.xz 83936936 BLAKE2B c052fff2838a0bdd87f90345a5f7f5c607a6fe360b02ce8cb076f6dd3a62f6aae0c7d3914eee447e9c92c971331ddcbf0c94f2aa120aef89a742162b5e7dbfdd SHA512 222bb6db05b23aeb428262c69319a4964097065a88a5ae6c19b104c31af82c465f139c08f01bb077b0e776685769b77a54b772ebc4e2057e7c3e8954283997cf
 DIST gcc-13.1.0-musl-patches-1.tar.xz 3528 BLAKE2B c572ab4a0fb929b16ec36b3a3616cdcccd62f7ee27ded8077008b9beb50539db64cc251ff8a3eade54e8ebfe1012f8f32d0802379bf8ffb0f1b8ce7c8457da37 SHA512 ffb7dfa54a9d23b5333664e915efd9f18a43cd696f4ff5669a8b072a0e9cf4978de53e315123542441a2533e4f269de0bb7d90ee7a37d3a7517b7cda6ea06681
 DIST gcc-13.1.0-patches-9.tar.xz 11720 BLAKE2B c26a2924fa8aab318a1f4a4974ca4aeba255f3605fa0cbf448a4e48b6f3e9359012aeae15726299059257b93043c5cdd86bf1b2f2fffd4b9a096ab411a0503ba SHA512 98e48abaa664ea18bf00ba7bdb29cc1e908cc55ba9d12d52061e86fc917753ade8e38a190c04d23c63102808ac5a9e8ecf085dcc29a1568a329ceb5d43cf0290

diff --git a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch
deleted file mode 100644
index 5d45d8f4e018..000000000000
--- a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6e3e708dbadaae7b504af7fc4410015624793f02
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109434
-
-From 6e3e708dbadaae7b504af7fc4410015624793f02 Mon Sep 17 00:00:00 2001
-From: Richard Biener <rguenther@suse.de>
-Date: Tue, 11 Apr 2023 15:06:59 +0200
-Subject: [PATCH] tree-optimization/109434 - bogus DSE of throwing call LHS
-
-The byte tracking of call LHS didn't properly handle possibly
-throwing calls correctly which cases bogus DSE and in turn, for the
-testcase a bogus uninit diagnostic and (unreliable) wrong-code.
-
-	PR tree-optimization/109434
-	* tree-ssa-dse.cc (initialize_ao_ref_for_dse): Properly
-	handle possibly throwing calls when processing the LHS
-	and may-defs are not OK.
-
-	* g++.dg/opt/pr109434.C: New testcase.
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/opt/pr109434.C
-@@ -0,0 +1,28 @@
-+// { dg-do compile }
-+// { dg-require-effective-target c++17 }
-+// { dg-options "-O2 -Wall" }
-+
-+#include <optional>
-+#include <stdexcept>
-+
-+std::optional<int> foo()
-+{
-+  volatile int x = 1;
-+  if (x)
-+    throw std::runtime_error("haha");
-+  return 42;
-+}
-+
-+int main()
-+{
-+  std::optional<int> optInt;
-+  try {
-+      // We falsely DSEd the LHS of the call even though foo throws
-+      // which results in an uninitialized diagnostic
-+      optInt = foo();
-+  } catch (...) {
-+      return optInt.has_value();
-+  }
-+  std::optional<double> optDbl{optInt};
-+  return optDbl ? optDbl.value () : 2.0;
-+}
---- a/gcc/tree-ssa-dse.cc
-+++ b/gcc/tree-ssa-dse.cc
-@@ -179,7 +179,8 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write, bool may_def_ok = false)
-     }
-   if (tree lhs = gimple_get_lhs (stmt))
-     {
--      if (TREE_CODE (lhs) != SSA_NAME)
-+      if (TREE_CODE (lhs) != SSA_NAME
-+	  && (may_def_ok || !stmt_could_throw_p (cfun, stmt)))
- 	{
- 	  ao_ref_init (write, lhs);
- 	  return true;
--- 
-2.31.1

diff --git a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109462-clang-LocalizationChecker-ranger-any-PHI.patch b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109462-clang-LocalizationChecker-ranger-any-PHI.patch
deleted file mode 100644
index 2b5ea5ad826a..000000000000
--- a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109462-clang-LocalizationChecker-ranger-any-PHI.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109462
-https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=24af552876eff707f75d30d3f0f0e7a5d62dd857
-
-From 24af552876eff707f75d30d3f0f0e7a5d62dd857 Mon Sep 17 00:00:00 2001
-From: Andrew MacLeod <amacleod@redhat.com>
-Date: Tue, 11 Apr 2023 17:29:03 -0400
-Subject: [PATCH] Don't use ANY PHI equivalences in range-on-entry.
-
-PR 108139 dissallows PHI equivalencies in the on-entry calculator, but
-it was only checking if the equivlaence was a PHI.  In this case, NAME
-itself is a PHI with an equivlaence caused by an undefined value, so we
-also need to check that case.  Unfortunately this un-fixes 101912.
-
-	PR tree-optimization/109462
-	gcc/
-	* gimple-range-cache.cc (ranger_cache::fill_block_cache): Don't
-	check for equivalences if NAME is a phi node.
-
-	gcc/testsuite/
-	* gcc.dg/uninit-pr101912.c: XFAIL the warning.
---- a/gcc/gimple-range-cache.cc
-+++ b/gcc/gimple-range-cache.cc
-@@ -1218,7 +1218,9 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
- 	  fprintf (dump_file, "\n");
- 	}
-       // See if any equivalences can refine it.
--      if (m_oracle)
-+      // PR 109462, like 108139 below, a one way equivalence introduced
-+      // by a PHI node can also be through the definition side.  Disallow it.
-+      if (m_oracle && !is_a<gphi *> (SSA_NAME_DEF_STMT (name)))
- 	{
- 	  tree equiv_name;
- 	  relation_kind rel;
---- a/gcc/testsuite/gcc.dg/uninit-pr101912.c
-+++ b/gcc/testsuite/gcc.dg/uninit-pr101912.c
-@@ -11,7 +11,7 @@ tzloadbody (void)
-   for (int i = 0; i < n; i++)
-     {
-       int corr = getint ();
--      if (corr < 1 || (corr == 1 && !(leapcnt == 0 || (prevcorr < corr ? corr == prevcorr + 1 : (corr == prevcorr || corr == prevcorr - 1))))) /* { dg-bogus "uninitialized" } */
-+      if (corr < 1 || (corr == 1 && !(leapcnt == 0 || (prevcorr < corr ? corr == prevcorr + 1 : (corr == prevcorr || corr == prevcorr - 1))))) /* { dg-bogus "uninitialized" "pr101912" { xfail *-*-* } } */
- 	return -1;
- 
-       prevcorr = corr;
--- 
-2.31.1

diff --git a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109469-SLP-returns-twice.patch b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109469-SLP-returns-twice.patch
deleted file mode 100644
index 7d45c9e60af8..000000000000
--- a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109469-SLP-returns-twice.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109469
-https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=2d7ad38707e1fd71193d440198cc0726092b9015
-
-From 2d7ad38707e1fd71193d440198cc0726092b9015 Mon Sep 17 00:00:00 2001
-From: Richard Biener <rguenther@suse.de>
-Date: Tue, 11 Apr 2023 16:06:12 +0200
-Subject: [PATCH] tree-optimization/109469 - SLP with returns-twice region
- start
-
-The following avoids an SLP region starting with a returns-twice
-call where we cannot insert stmts at the head.
-
-	PR tree-optimization/109469
-	* tree-vect-slp.cc (vect_slp_function): Skip region starts with
-	a returns-twice call.
-
-	* gcc.dg/torture/pr109469.c: New testcase.
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/torture/pr109469.c
-@@ -0,0 +1,15 @@
-+/* { dg-do compile } */
-+
-+__attribute__((returns_twice)) int foo();
-+
-+struct xio myproc;
-+struct xio {
-+  void (*read_proc)();
-+  void (*write_proc)();
-+};
-+
-+void dummy_write_proc() {
-+  switch (foo())
-+  default:
-+    myproc.read_proc = myproc.write_proc = dummy_write_proc;
-+}
---- a/gcc/tree-vect-slp.cc
-+++ b/gcc/tree-vect-slp.cc
-@@ -7671,10 +7671,23 @@ vect_slp_function (function *fun)
- 	{
- 	  r |= vect_slp_bbs (bbs, NULL);
- 	  bbs.truncate (0);
--	  bbs.quick_push (bb);
- 	}
--      else
--	bbs.safe_push (bb);
-+
-+      /* We need to be able to insert at the head of the region which
-+	 we cannot for region starting with a returns-twice call.  */
-+      if (bbs.is_empty ())
-+	if (gcall *first = safe_dyn_cast <gcall *> (first_stmt (bb)))
-+	  if (gimple_call_flags (first) & ECF_RETURNS_TWICE)
-+	    {
-+	      if (dump_enabled_p ())
-+		dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-+				 "skipping bb%d as start of region as it "
-+				 "starts with returns-twice call\n",
-+				 bb->index);
-+	      continue;
-+	    }
-+
-+      bbs.safe_push (bb);
- 
-       /* When we have a stmt ending this block and defining a
- 	 value we have to insert on edges when inserting after it for
--- 
-2.31.1

diff --git a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109473-ICE-reduction-epilog.patch b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109473-ICE-reduction-epilog.patch
deleted file mode 100644
index cab26653a09d..000000000000
--- a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109473-ICE-reduction-epilog.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=df7f55cb2ae550adeda339a57b657ebe1ad39367
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109473
-
-From df7f55cb2ae550adeda339a57b657ebe1ad39367 Mon Sep 17 00:00:00 2001
-From: Richard Biener <rguenther@suse.de>
-Date: Wed, 12 Apr 2023 10:22:08 +0200
-Subject: [PATCH] tree-optimization/109473 - ICE with reduction epilog
- adjustment op
-
-The following makes sure to carry out the reduction epilog adjustment
-in the original computation type which for pointers is an unsigned
-integer type.  There's a similar issue with signed vs. unsigned ops
-and overflow which is fixed by this as well.
-
-	PR tree-optimization/109473
-	* tree-vect-loop.cc (vect_create_epilog_for_reduction):
-	Convert scalar result to the computation type before performing
-	the reduction adjustment.
-
-	* gcc.dg/vect/pr109473.c: New testcase.
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/vect/pr109473.c
-@@ -0,0 +1,16 @@
-+/* { dg-do compile } */
-+/* { dg-additional-options "-O" } */
-+
-+struct spa_buffer {
-+  __UINT32_TYPE__ *metas;
-+};
-+void do_port_use_buffers(struct spa_buffer **buffers, void *endptr, void *mem)
-+{
-+  for (int i = 0; i < 128; i++)
-+    {
-+      for (int j = 0; j < 128; j++)
-+	endptr = (void *)((__UINTPTR_TYPE__)endptr + buffers[i]->metas[j]);
-+      if (endptr > mem)
-+	return;
-+    }
-+}
---- a/gcc/tree-vect-loop.cc
-+++ b/gcc/tree-vect-loop.cc
-@@ -6297,9 +6297,12 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
- 	{
-           new_temp = scalar_results[0];
- 	  gcc_assert (TREE_CODE (TREE_TYPE (adjustment_def)) != VECTOR_TYPE);
--	  adjustment_def = gimple_convert (&stmts, scalar_type, adjustment_def);
--	  new_temp = gimple_build (&stmts, code, scalar_type,
-+	  adjustment_def = gimple_convert (&stmts, TREE_TYPE (vectype),
-+					   adjustment_def);
-+	  new_temp = gimple_convert (&stmts, TREE_TYPE (vectype), new_temp);
-+	  new_temp = gimple_build (&stmts, code, TREE_TYPE (vectype),
- 				   new_temp, adjustment_def);
-+	  new_temp = gimple_convert (&stmts, scalar_type, new_temp);
- 	}
- 
-       epilog_stmt = gimple_seq_last_stmt (stmts);
--- 
-2.31.1

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230409-r1.ebuild b/sys-devel/gcc/gcc-13.0.1_pre20230409-r1.ebuild
deleted file mode 100644
index f476227f8198..000000000000
--- a/sys-devel/gcc/gcc-13.0.1_pre20230409-r1.ebuild
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-TOOLCHAIN_PATCH_DEV="sam"
-PATCH_VER="9"
-PATCH_GCC_VER="13.1.0"
-MUSL_VER="1"
-MUSL_GCC_VER="13.1.0"
-
-if [[ $(ver_cut 3) == 9999 ]] ; then
-	MY_PV_2=$(ver_cut 2)
-	MY_PV_3=$(($(ver_cut 3) - 9998))
-	if [[ ${MY_PV_2} == 0 ]] ; then
-		MY_PV_2=0
-		MY_PV_3=0
-	else
-		MY_PV_2=$(($(ver_cut 2) - 1))
-	fi
-
-	# e.g. 12.2.9999 -> 12.1.1
-	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.${MY_PV_3}
-fi
-
-inherit toolchain
-# Needs to be after inherit (for now?), bug #830908
-EGIT_BRANCH=master
-
-# Don't keyword live ebuilds
-if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
-#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	KEYWORDS="~loong"
-fi
-
-if [[ ${CATEGORY} != cross-* ]] ; then
-	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
-	# If GCC is enabling CET by default, we need glibc to be built with support for it.
-	# bug #830454
-	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
-	DEPEND="${RDEPEND}"
-	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
-fi
-
-src_prepare() {
-	local p upstreamed_patches=(
-		# add them here
-	)
-	for p in "${upstreamed_patches[@]}"; do
-		rm -v "${WORKDIR}/patch/${p}" || die
-	done
-
-	toolchain_src_prepare
-
-	eapply_user
-}

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild b/sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild
deleted file mode 100644
index 527b71d68608..000000000000
--- a/sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-TOOLCHAIN_PATCH_DEV="sam"
-PATCH_VER="9"
-PATCH_GCC_VER="13.1.0"
-MUSL_VER="1"
-MUSL_GCC_VER="13.1.0"
-
-if [[ $(ver_cut 3) == 9999 ]] ; then
-	MY_PV_2=$(ver_cut 2)
-	MY_PV_3=$(($(ver_cut 3) - 9998))
-	if [[ ${MY_PV_2} == 0 ]] ; then
-		MY_PV_2=0
-		MY_PV_3=0
-	else
-		MY_PV_2=$(($(ver_cut 2) - 1))
-	fi
-
-	# e.g. 12.2.9999 -> 12.1.1
-	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.${MY_PV_3}
-fi
-
-inherit toolchain
-# Needs to be after inherit (for now?), bug #830908
-EGIT_BRANCH=master
-
-# Don't keyword live ebuilds
-if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
-#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	KEYWORDS="~loong"
-fi
-
-if [[ ${CATEGORY} != cross-* ]] ; then
-	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
-	# If GCC is enabling CET by default, we need glibc to be built with support for it.
-	# bug #830454
-	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
-	DEPEND="${RDEPEND}"
-	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
-fi
-
-src_prepare() {
-	local p upstreamed_patches=(
-		# add them here
-	)
-	for p in "${upstreamed_patches[@]}"; do
-		rm -v "${WORKDIR}/patch/${p}" || die
-	done
-
-	toolchain_src_prepare
-
-	eapply "${FILESDIR}"/${P}-PR109469-SLP-returns-twice.patch
-	eapply_user
-}

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild b/sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild
deleted file mode 100644
index 073f68b644ac..000000000000
--- a/sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-TOOLCHAIN_PATCH_DEV="sam"
-PATCH_VER="9"
-PATCH_GCC_VER="13.1.0"
-MUSL_VER="1"
-MUSL_GCC_VER="13.1.0"
-
-if [[ $(ver_cut 3) == 9999 ]] ; then
-	MY_PV_2=$(ver_cut 2)
-	MY_PV_3=$(($(ver_cut 3) - 9998))
-	if [[ ${MY_PV_2} == 0 ]] ; then
-		MY_PV_2=0
-		MY_PV_3=0
-	else
-		MY_PV_2=$(($(ver_cut 2) - 1))
-	fi
-
-	# e.g. 12.2.9999 -> 12.1.1
-	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.${MY_PV_3}
-fi
-
-inherit toolchain
-# Needs to be after inherit (for now?), bug #830908
-EGIT_BRANCH=master
-
-# Don't keyword live ebuilds
-if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
-#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	KEYWORDS="~loong"
-fi
-
-if [[ ${CATEGORY} != cross-* ]] ; then
-	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
-	# If GCC is enabling CET by default, we need glibc to be built with support for it.
-	# bug #830454
-	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
-	DEPEND="${RDEPEND}"
-	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
-fi
-
-src_prepare() {
-	local p upstreamed_patches=(
-		# add them here
-	)
-	for p in "${upstreamed_patches[@]}"; do
-		rm -v "${WORKDIR}/patch/${p}" || die
-	done
-
-	toolchain_src_prepare
-
-	eapply "${FILESDIR}"/${P}-PR109469-SLP-returns-twice.patch
-	eapply "${FILESDIR}"/${P}-PR109434-DSE-throw.patch
-	eapply_user
-}

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230409-r4.ebuild b/sys-devel/gcc/gcc-13.0.1_pre20230409-r4.ebuild
deleted file mode 100644
index f1ae324ca919..000000000000
--- a/sys-devel/gcc/gcc-13.0.1_pre20230409-r4.ebuild
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-TOOLCHAIN_PATCH_DEV="sam"
-PATCH_VER="9"
-PATCH_GCC_VER="13.1.0"
-MUSL_VER="1"
-MUSL_GCC_VER="13.1.0"
-
-if [[ $(ver_cut 3) == 9999 ]] ; then
-	MY_PV_2=$(ver_cut 2)
-	MY_PV_3=$(($(ver_cut 3) - 9998))
-	if [[ ${MY_PV_2} == 0 ]] ; then
-		MY_PV_2=0
-		MY_PV_3=0
-	else
-		MY_PV_2=$(($(ver_cut 2) - 1))
-	fi
-
-	# e.g. 12.2.9999 -> 12.1.1
-	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.${MY_PV_3}
-fi
-
-inherit toolchain
-# Needs to be after inherit (for now?), bug #830908
-EGIT_BRANCH=master
-
-# Don't keyword live ebuilds
-if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
-#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	KEYWORDS="~loong"
-fi
-
-if [[ ${CATEGORY} != cross-* ]] ; then
-	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
-	# If GCC is enabling CET by default, we need glibc to be built with support for it.
-	# bug #830454
-	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
-	DEPEND="${RDEPEND}"
-	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
-fi
-
-src_prepare() {
-	local p upstreamed_patches=(
-		# add them here
-	)
-	for p in "${upstreamed_patches[@]}"; do
-		rm -v "${WORKDIR}/patch/${p}" || die
-	done
-
-	toolchain_src_prepare
-
-	eapply "${FILESDIR}"/${P}-PR109469-SLP-returns-twice.patch
-	eapply "${FILESDIR}"/${P}-PR109434-DSE-throw.patch
-	eapply "${FILESDIR}"/${P}-PR109473-ICE-reduction-epilog.patch
-	eapply "${FILESDIR}"/${P}-PR109462-clang-LocalizationChecker-ranger-any-PHI.patch
-	eapply_user
-}

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230409.ebuild b/sys-devel/gcc/gcc-13.0.1_pre20230409.ebuild
deleted file mode 100644
index f476227f8198..000000000000
--- a/sys-devel/gcc/gcc-13.0.1_pre20230409.ebuild
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-TOOLCHAIN_PATCH_DEV="sam"
-PATCH_VER="9"
-PATCH_GCC_VER="13.1.0"
-MUSL_VER="1"
-MUSL_GCC_VER="13.1.0"
-
-if [[ $(ver_cut 3) == 9999 ]] ; then
-	MY_PV_2=$(ver_cut 2)
-	MY_PV_3=$(($(ver_cut 3) - 9998))
-	if [[ ${MY_PV_2} == 0 ]] ; then
-		MY_PV_2=0
-		MY_PV_3=0
-	else
-		MY_PV_2=$(($(ver_cut 2) - 1))
-	fi
-
-	# e.g. 12.2.9999 -> 12.1.1
-	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.${MY_PV_3}
-fi
-
-inherit toolchain
-# Needs to be after inherit (for now?), bug #830908
-EGIT_BRANCH=master
-
-# Don't keyword live ebuilds
-if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
-#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-	KEYWORDS="~loong"
-fi
-
-if [[ ${CATEGORY} != cross-* ]] ; then
-	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
-	# If GCC is enabling CET by default, we need glibc to be built with support for it.
-	# bug #830454
-	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
-	DEPEND="${RDEPEND}"
-	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
-fi
-
-src_prepare() {
-	local p upstreamed_patches=(
-		# add them here
-	)
-	for p in "${upstreamed_patches[@]}"; do
-		rm -v "${WORKDIR}/patch/${p}" || die
-	done
-
-	toolchain_src_prepare
-
-	eapply_user
-}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2023-04-12 13:23 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2023-04-12 13:23 UTC (permalink / raw
  To: gentoo-commits

commit:     efd15a6fa5db222c80ae272f77ae229340e4fb20
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 12 13:20:36 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr 12 13:23:23 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=efd15a6f

sys-devel/gcc: backport two more patches for 13 (checking ICE + Clang miscompilation)

First fix is a checking ICE. As we're new to handling checking (see previous commits),
these are generally a sign of possible wrong-code/miscompilation, so it's nice
when checking flags it up and turns the issue into an ICE. So, don't be fooled
by the ICE part.

Second is a miscompilation of Clang which leads to a test failure.

I wouldn't normally backport so many of these, but they're all things we've
found through testing in Gentoo over the last few days, and it's especially
important given GCC 13 is imminent.

Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109473
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109462
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-clang-LocalizationChecker-ranger-any-PHI.patch | 46 +++++++++++++++++
 ...pre20230409-PR109473-ICE-reduction-epilog.patch | 58 +++++++++++++++++++++
 sys-devel/gcc/gcc-13.0.1_pre20230409-r4.ebuild     | 60 ++++++++++++++++++++++
 3 files changed, 164 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109462-clang-LocalizationChecker-ranger-any-PHI.patch b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109462-clang-LocalizationChecker-ranger-any-PHI.patch
new file mode 100644
index 000000000000..2b5ea5ad826a
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109462-clang-LocalizationChecker-ranger-any-PHI.patch
@@ -0,0 +1,46 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109462
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=24af552876eff707f75d30d3f0f0e7a5d62dd857
+
+From 24af552876eff707f75d30d3f0f0e7a5d62dd857 Mon Sep 17 00:00:00 2001
+From: Andrew MacLeod <amacleod@redhat.com>
+Date: Tue, 11 Apr 2023 17:29:03 -0400
+Subject: [PATCH] Don't use ANY PHI equivalences in range-on-entry.
+
+PR 108139 dissallows PHI equivalencies in the on-entry calculator, but
+it was only checking if the equivlaence was a PHI.  In this case, NAME
+itself is a PHI with an equivlaence caused by an undefined value, so we
+also need to check that case.  Unfortunately this un-fixes 101912.
+
+	PR tree-optimization/109462
+	gcc/
+	* gimple-range-cache.cc (ranger_cache::fill_block_cache): Don't
+	check for equivalences if NAME is a phi node.
+
+	gcc/testsuite/
+	* gcc.dg/uninit-pr101912.c: XFAIL the warning.
+--- a/gcc/gimple-range-cache.cc
++++ b/gcc/gimple-range-cache.cc
+@@ -1218,7 +1218,9 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
+ 	  fprintf (dump_file, "\n");
+ 	}
+       // See if any equivalences can refine it.
+-      if (m_oracle)
++      // PR 109462, like 108139 below, a one way equivalence introduced
++      // by a PHI node can also be through the definition side.  Disallow it.
++      if (m_oracle && !is_a<gphi *> (SSA_NAME_DEF_STMT (name)))
+ 	{
+ 	  tree equiv_name;
+ 	  relation_kind rel;
+--- a/gcc/testsuite/gcc.dg/uninit-pr101912.c
++++ b/gcc/testsuite/gcc.dg/uninit-pr101912.c
+@@ -11,7 +11,7 @@ tzloadbody (void)
+   for (int i = 0; i < n; i++)
+     {
+       int corr = getint ();
+-      if (corr < 1 || (corr == 1 && !(leapcnt == 0 || (prevcorr < corr ? corr == prevcorr + 1 : (corr == prevcorr || corr == prevcorr - 1))))) /* { dg-bogus "uninitialized" } */
++      if (corr < 1 || (corr == 1 && !(leapcnt == 0 || (prevcorr < corr ? corr == prevcorr + 1 : (corr == prevcorr || corr == prevcorr - 1))))) /* { dg-bogus "uninitialized" "pr101912" { xfail *-*-* } } */
+ 	return -1;
+ 
+       prevcorr = corr;
+-- 
+2.31.1

diff --git a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109473-ICE-reduction-epilog.patch b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109473-ICE-reduction-epilog.patch
new file mode 100644
index 000000000000..cab26653a09d
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109473-ICE-reduction-epilog.patch
@@ -0,0 +1,58 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=df7f55cb2ae550adeda339a57b657ebe1ad39367
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109473
+
+From df7f55cb2ae550adeda339a57b657ebe1ad39367 Mon Sep 17 00:00:00 2001
+From: Richard Biener <rguenther@suse.de>
+Date: Wed, 12 Apr 2023 10:22:08 +0200
+Subject: [PATCH] tree-optimization/109473 - ICE with reduction epilog
+ adjustment op
+
+The following makes sure to carry out the reduction epilog adjustment
+in the original computation type which for pointers is an unsigned
+integer type.  There's a similar issue with signed vs. unsigned ops
+and overflow which is fixed by this as well.
+
+	PR tree-optimization/109473
+	* tree-vect-loop.cc (vect_create_epilog_for_reduction):
+	Convert scalar result to the computation type before performing
+	the reduction adjustment.
+
+	* gcc.dg/vect/pr109473.c: New testcase.
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/vect/pr109473.c
+@@ -0,0 +1,16 @@
++/* { dg-do compile } */
++/* { dg-additional-options "-O" } */
++
++struct spa_buffer {
++  __UINT32_TYPE__ *metas;
++};
++void do_port_use_buffers(struct spa_buffer **buffers, void *endptr, void *mem)
++{
++  for (int i = 0; i < 128; i++)
++    {
++      for (int j = 0; j < 128; j++)
++	endptr = (void *)((__UINTPTR_TYPE__)endptr + buffers[i]->metas[j]);
++      if (endptr > mem)
++	return;
++    }
++}
+--- a/gcc/tree-vect-loop.cc
++++ b/gcc/tree-vect-loop.cc
+@@ -6297,9 +6297,12 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
+ 	{
+           new_temp = scalar_results[0];
+ 	  gcc_assert (TREE_CODE (TREE_TYPE (adjustment_def)) != VECTOR_TYPE);
+-	  adjustment_def = gimple_convert (&stmts, scalar_type, adjustment_def);
+-	  new_temp = gimple_build (&stmts, code, scalar_type,
++	  adjustment_def = gimple_convert (&stmts, TREE_TYPE (vectype),
++					   adjustment_def);
++	  new_temp = gimple_convert (&stmts, TREE_TYPE (vectype), new_temp);
++	  new_temp = gimple_build (&stmts, code, TREE_TYPE (vectype),
+ 				   new_temp, adjustment_def);
++	  new_temp = gimple_convert (&stmts, scalar_type, new_temp);
+ 	}
+ 
+       epilog_stmt = gimple_seq_last_stmt (stmts);
+-- 
+2.31.1

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230409-r4.ebuild b/sys-devel/gcc/gcc-13.0.1_pre20230409-r4.ebuild
new file mode 100644
index 000000000000..f1ae324ca919
--- /dev/null
+++ b/sys-devel/gcc/gcc-13.0.1_pre20230409-r4.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+TOOLCHAIN_PATCH_DEV="sam"
+PATCH_VER="9"
+PATCH_GCC_VER="13.1.0"
+MUSL_VER="1"
+MUSL_GCC_VER="13.1.0"
+
+if [[ $(ver_cut 3) == 9999 ]] ; then
+	MY_PV_2=$(ver_cut 2)
+	MY_PV_3=$(($(ver_cut 3) - 9998))
+	if [[ ${MY_PV_2} == 0 ]] ; then
+		MY_PV_2=0
+		MY_PV_3=0
+	else
+		MY_PV_2=$(($(ver_cut 2) - 1))
+	fi
+
+	# e.g. 12.2.9999 -> 12.1.1
+	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.${MY_PV_3}
+fi
+
+inherit toolchain
+# Needs to be after inherit (for now?), bug #830908
+EGIT_BRANCH=master
+
+# Don't keyword live ebuilds
+if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~loong"
+fi
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
+	# If GCC is enabling CET by default, we need glibc to be built with support for it.
+	# bug #830454
+	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
+	DEPEND="${RDEPEND}"
+	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
+fi
+
+src_prepare() {
+	local p upstreamed_patches=(
+		# add them here
+	)
+	for p in "${upstreamed_patches[@]}"; do
+		rm -v "${WORKDIR}/patch/${p}" || die
+	done
+
+	toolchain_src_prepare
+
+	eapply "${FILESDIR}"/${P}-PR109469-SLP-returns-twice.patch
+	eapply "${FILESDIR}"/${P}-PR109434-DSE-throw.patch
+	eapply "${FILESDIR}"/${P}-PR109473-ICE-reduction-epilog.patch
+	eapply "${FILESDIR}"/${P}-PR109462-clang-LocalizationChecker-ranger-any-PHI.patch
+	eapply_user
+}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2023-04-12  7:35 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2023-04-12  7:35 UTC (permalink / raw
  To: gentoo-commits

commit:     989bee28461116343b958e978fe19472fe2ea3cb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 12 07:20:32 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr 12 07:35:03 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=989bee28

sys-devel/gcc: fix SLP returns_twice issue for 13

This fixes a checking (which we now do by default for pre-releases) ICE
for busybox/xdvik, but it's potentially more serious anyway.

Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109469
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ....1_pre20230409-PR109469-SLP-returns-twice.patch | 66 ++++++++++++++++++++++
 sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild     | 57 +++++++++++++++++++
 2 files changed, 123 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109469-SLP-returns-twice.patch b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109469-SLP-returns-twice.patch
new file mode 100644
index 000000000000..7d45c9e60af8
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109469-SLP-returns-twice.patch
@@ -0,0 +1,66 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109469
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=2d7ad38707e1fd71193d440198cc0726092b9015
+
+From 2d7ad38707e1fd71193d440198cc0726092b9015 Mon Sep 17 00:00:00 2001
+From: Richard Biener <rguenther@suse.de>
+Date: Tue, 11 Apr 2023 16:06:12 +0200
+Subject: [PATCH] tree-optimization/109469 - SLP with returns-twice region
+ start
+
+The following avoids an SLP region starting with a returns-twice
+call where we cannot insert stmts at the head.
+
+	PR tree-optimization/109469
+	* tree-vect-slp.cc (vect_slp_function): Skip region starts with
+	a returns-twice call.
+
+	* gcc.dg/torture/pr109469.c: New testcase.
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/torture/pr109469.c
+@@ -0,0 +1,15 @@
++/* { dg-do compile } */
++
++__attribute__((returns_twice)) int foo();
++
++struct xio myproc;
++struct xio {
++  void (*read_proc)();
++  void (*write_proc)();
++};
++
++void dummy_write_proc() {
++  switch (foo())
++  default:
++    myproc.read_proc = myproc.write_proc = dummy_write_proc;
++}
+--- a/gcc/tree-vect-slp.cc
++++ b/gcc/tree-vect-slp.cc
+@@ -7671,10 +7671,23 @@ vect_slp_function (function *fun)
+ 	{
+ 	  r |= vect_slp_bbs (bbs, NULL);
+ 	  bbs.truncate (0);
+-	  bbs.quick_push (bb);
+ 	}
+-      else
+-	bbs.safe_push (bb);
++
++      /* We need to be able to insert at the head of the region which
++	 we cannot for region starting with a returns-twice call.  */
++      if (bbs.is_empty ())
++	if (gcall *first = safe_dyn_cast <gcall *> (first_stmt (bb)))
++	  if (gimple_call_flags (first) & ECF_RETURNS_TWICE)
++	    {
++	      if (dump_enabled_p ())
++		dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
++				 "skipping bb%d as start of region as it "
++				 "starts with returns-twice call\n",
++				 bb->index);
++	      continue;
++	    }
++
++      bbs.safe_push (bb);
+ 
+       /* When we have a stmt ending this block and defining a
+ 	 value we have to insert on edges when inserting after it for
+-- 
+2.31.1

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild b/sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild
new file mode 100644
index 000000000000..527b71d68608
--- /dev/null
+++ b/sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+TOOLCHAIN_PATCH_DEV="sam"
+PATCH_VER="9"
+PATCH_GCC_VER="13.1.0"
+MUSL_VER="1"
+MUSL_GCC_VER="13.1.0"
+
+if [[ $(ver_cut 3) == 9999 ]] ; then
+	MY_PV_2=$(ver_cut 2)
+	MY_PV_3=$(($(ver_cut 3) - 9998))
+	if [[ ${MY_PV_2} == 0 ]] ; then
+		MY_PV_2=0
+		MY_PV_3=0
+	else
+		MY_PV_2=$(($(ver_cut 2) - 1))
+	fi
+
+	# e.g. 12.2.9999 -> 12.1.1
+	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.${MY_PV_3}
+fi
+
+inherit toolchain
+# Needs to be after inherit (for now?), bug #830908
+EGIT_BRANCH=master
+
+# Don't keyword live ebuilds
+if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~loong"
+fi
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
+	# If GCC is enabling CET by default, we need glibc to be built with support for it.
+	# bug #830454
+	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
+	DEPEND="${RDEPEND}"
+	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
+fi
+
+src_prepare() {
+	local p upstreamed_patches=(
+		# add them here
+	)
+	for p in "${upstreamed_patches[@]}"; do
+		rm -v "${WORKDIR}/patch/${p}" || die
+	done
+
+	toolchain_src_prepare
+
+	eapply "${FILESDIR}"/${P}-PR109469-SLP-returns-twice.patch
+	eapply_user
+}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2023-04-05  1:18 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2023-04-05  1:18 UTC (permalink / raw
  To: gentoo-commits

commit:     f5200bf6e1bf373bc4a04128746ad64ca29d2626
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Apr  5 01:10:58 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr  5 01:10:58 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f5200bf6

sys-devel/gcc: backport 13 fix for Python 3.12 ICE

Closes: https://bugs.gentoo.org/903245
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...3.0.1_pre20230402-PR109304-ICE-python3.12.patch | 72 ++++++++++++++++++++++
 sys-devel/gcc/gcc-13.0.1_pre20230402-r1.ebuild     | 57 +++++++++++++++++
 2 files changed, 129 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13.0.1_pre20230402-PR109304-ICE-python3.12.patch b/sys-devel/gcc/files/gcc-13.0.1_pre20230402-PR109304-ICE-python3.12.patch
new file mode 100644
index 000000000000..8b6baea37b70
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13.0.1_pre20230402-PR109304-ICE-python3.12.patch
@@ -0,0 +1,72 @@
+https://bugs.gentoo.org/903245
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109304
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=d0b961b802dd7d9d555ff4515835a479329326e9
+
+From d0b961b802dd7d9d555ff4515835a479329326e9 Mon Sep 17 00:00:00 2001
+From: Richard Biener <rguenther@suse.de>
+Date: Tue, 28 Mar 2023 08:06:12 +0000
+Subject: [PATCH] tree-optimization/109304 - properly handle instrumented
+ aliases
+
+When adjusting calls to reflect instrumentation we failed to handle
+calls to aliases since they appear to have no body.  Instead resort
+to symtab node availability.  The patch also avoids touching
+internal function calls in a more obvious way (builtins might
+have a body available).
+
+profiledbootstrap & regtest running on x86_64-unknown-linux-gnu.
+
+Honza - does this look OK?
+
+	PR tree-optimization/109304
+	* tree-profile.cc (tree_profiling): Use symtab node
+	availability to decide whether to skip adjusting calls.
+	Do not adjust calls to internal functions.
+
+	* gcc.dg/pr109304.c: New testcase.
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/pr109304.c
+@@ -0,0 +1,12 @@
++/* { dg-do compile } */
++/* { dg-require-profiling "-fprofile-generate" } */
++/* { dg-require-effective-target fpic } */
++/* { dg-options "-O3 -fprofile-generate -fPIC -fno-semantic-interposition" } */
++
++int PyUnicode_FindChar_i;
++int PyUnicode_FindChar()
++{
++  while (PyUnicode_FindChar_i)
++    if (PyUnicode_FindChar())
++      break;
++}
+--- a/gcc/tree-profile.cc
++++ b/gcc/tree-profile.cc
+@@ -808,7 +808,7 @@ tree_profiling (void)
+       {
+ 	if (!gimple_has_body_p (node->decl)
+ 	    || !(!node->clone_of
+-	    || node->decl != node->clone_of->decl))
++		 || node->decl != node->clone_of->decl))
+ 	  continue;
+ 
+ 	/* Don't profile functions produced for builtin stuff.  */
+@@ -842,12 +842,15 @@ tree_profiling (void)
+ 	    for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ 	      {
+ 		gcall *call = dyn_cast <gcall *> (gsi_stmt (gsi));
+-		if (!call)
++		if (!call || gimple_call_internal_p (call))
+ 		  continue;
+ 
+ 		/* We do not clear pure/const on decls without body.  */
+ 		tree fndecl = gimple_call_fndecl (call);
+-		if (fndecl && !gimple_has_body_p (fndecl))
++		cgraph_node *callee;
++		if (fndecl
++		    && (callee = cgraph_node::get (fndecl))
++		    && callee->get_availability (node) == AVAIL_NOT_AVAILABLE)
+ 		  continue;
+ 
+ 		/* Drop the const attribute from the call type (the pure
+-- 
+2.31.1

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230402-r1.ebuild b/sys-devel/gcc/gcc-13.0.1_pre20230402-r1.ebuild
new file mode 100644
index 000000000000..004f9937b489
--- /dev/null
+++ b/sys-devel/gcc/gcc-13.0.1_pre20230402-r1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+TOOLCHAIN_PATCH_DEV="sam"
+PATCH_VER="9"
+PATCH_GCC_VER="13.1.0"
+MUSL_VER="1"
+MUSL_GCC_VER="13.1.0"
+
+if [[ $(ver_cut 3) == 9999 ]] ; then
+	MY_PV_2=$(ver_cut 2)
+	MY_PV_3=$(($(ver_cut 3) - 9998))
+	if [[ ${MY_PV_2} == 0 ]] ; then
+		MY_PV_2=0
+		MY_PV_3=0
+	else
+		MY_PV_2=$(($(ver_cut 2) - 1))
+	fi
+
+	# e.g. 12.2.9999 -> 12.1.1
+	TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.${MY_PV_3}
+fi
+
+inherit toolchain
+# Needs to be after inherit (for now?), bug #830908
+EGIT_BRANCH=master
+
+# Don't keyword live ebuilds
+if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+#	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+	KEYWORDS="~loong"
+fi
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+	# Technically only if USE=hardened *too* right now, but no point in complicating it further.
+	# If GCC is enabling CET by default, we need glibc to be built with support for it.
+	# bug #830454
+	RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
+	DEPEND="${RDEPEND}"
+	BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
+fi
+
+src_prepare() {
+	local p upstreamed_patches=(
+		# add them here
+	)
+	for p in "${upstreamed_patches[@]}"; do
+		rm -v "${WORKDIR}/patch/${p}" || die
+	done
+
+	toolchain_src_prepare
+
+	eapply "${FILESDIR}"/${P}-PR109304-ICE-python3.12.patch
+	eapply_user
+}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2022-08-22  1:41 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2022-08-22  1:41 UTC (permalink / raw
  To: gentoo-commits

commit:     49c1f635b4bb5b309af50879719dde4b5c5170c3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 22 01:19:07 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 22 01:27:24 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49c1f635

sys-devel/gcc: fix glibc-2.36 build for Go too for 11.3.0

Bug: https://bugs.gentoo.org/865879
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/gcc/Manifest                          |  4 +--
 sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch | 41 -------------------------
 sys-devel/gcc/gcc-11.3.0.ebuild                 | 10 ++----
 3 files changed, 4 insertions(+), 51 deletions(-)

diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index c35c999ace2b..db2cddc22cbd 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -11,8 +11,8 @@ DIST gcc-10.4.0-patches-2.tar.xz 15000 BLAKE2B 59a61f7de4b6d2338a8b4fbc88a8e5583
 DIST gcc-10.4.0.tar.xz 75018092 BLAKE2B ec1169025d3896b70ab80a4b8ce5040763a95529fc7e120c6bc3a3eb1db5cf938ebde347c1e595a8ff7d4081e79ded6252702d7a1a09648449b7a0783188e434 SHA512 440c08ca746da450d9a1b35e8fd2305cb27e7e6987cd9d0f7d375f3b1fc9e4b0bd7acb3cd7bf795e72fcbead59cdef5b6c152862f5d35cd9fbfe6902101ce648
 DIST gcc-11-20220812.tar.xz 75781320 BLAKE2B f7776dcc0168cd0b624760deab9185b36e2f5718cdacb7cff911813791ed31321b34b5f14ee6e3264c61a95c5cd8cf80c93e6e80f6fdac5f49818e0f5c242486 SHA512 d2fbc18dcac84951c541d90a78719254429b133de05e4f6f37e3d3c160695ea5e2e6563cd78b90bdce29cb2e465aabe4215ec1262bb74c23eba2be57be074070
 DIST gcc-11-20220819.tar.xz 75783200 BLAKE2B f047e2839932eb648f43e80cd80d940262f618093f340a51143eb857323b47a14725d733587dec06808c356cb153d0f35cf210806f5f8990e290f78dcb277568 SHA512 aa1418df17221d999ae4d3dd4fcab0f9c7a481e67dae98231b82bbc04f4df06b2add85e664e68e39616255644aa0dfb2df95cad485ec3f02e9db58740e37d8ca
-DIST gcc-11.3.0-musl-patches-1.tar.bz2 3997 BLAKE2B 5ca064cc78b067f4a7822fa0341c37ae03c8024f871d2e274e481a583afa96c36e291be93fbdd633f203260ae2ea9ac1d45f666d134bac75bc9a715a369d7374 SHA512 0ab239c66cf62a737266377c19b8dda6af6df56380f6731c2c17f3e82778e7e023a68d31728490eea3ad946f4b71d4cab363a75548f74b4b7f653972469d9e91
-DIST gcc-11.3.0-patches-5.tar.bz2 14575 BLAKE2B 55ff9558f3ffe89d511663f12477e72ed1bc29d4fa8f1bc58b9c52d28838716ba9b8291ede7b86e28c3bee0633c34763f611779fe46531bd75d8aa7661b46118 SHA512 65bf4c0d1d43923298efd527a5f4da2a10d88a383d2eef72e6a25ce37964ddaf27c49545915228347e8320f905afcdfe1275d98e8458993a7229425f74ae41bd
+DIST gcc-11.3.0-musl-patches-1.tar.xz 3768 BLAKE2B c591bc66f9d2e97d1b2450001dda15e9fc5b9b933cb52661815dd4a12db7973adb8d05b42a9c90badc29f06be690d98fc7fdeb3f3177497241560ed1211835ab SHA512 ca7b1e2351b2b6b4dbc19a04ca79e37d229498b3e61715e9c72abc83357dce056b37c4a31fe92497a37eb4ffbfebf13d38c2cfda81b97c1b825f99a692cd6d31
+DIST gcc-11.3.0-patches-6.tar.xz 14776 BLAKE2B de0699621f366cb2569df22a54e8b758deaddb784162d2ba4070c9b25d1ffa4b2d3b8671c16424afa027384be18bacb8d96293feb32e0b90292c5d84aa35842b SHA512 a4856307a4d21030c0fe5d13f7c05b32597ba949a84ecb20f7453392cbe1557231a88cd5fa1bffdc815a06ad3b139f2e13503872d4655de23dbe14465e525d54
 DIST gcc-11.3.0.tar.xz 81141364 BLAKE2B 7e562d25446ca4ab9fe8cdb714866f66aba3744d78bf84f31bfb097c1a981e4c7f990cb1e6bcfec5ae6671836a4984e2b70eb8fed81dcef5e244f88da8623469 SHA512 f0be5ad705c73b84477128a69c047f57dd47002f375eb60e1e842e08cf2009a509e92152bca345823926d550b7395ae6d4de7db51d1ee371c2dc37313881fca7
 DIST gcc-11.4.0-musl-patches-0.tar.xz 3844 BLAKE2B f3f1be6718e3cf08e553a1a2319a85e13368279849f6f3ab89ad7abe505316afacf5084846c0cb133bdcb5c918244644242c194e6ce55455a26e67b3983d73ef SHA512 a81db52d21de364137461dcff7e1af696df4a02fa26452f90439ae4af14ccbffe68eb4ee93ae56257490ab8aa36b4bff37c4e1f2cf4dd4624b3a6fb4cb50b7ac
 DIST gcc-11.4.0-patches-1.tar.xz 13956 BLAKE2B ff6ee1b81ad214e74a49c00b15767086c6b12b1566b42c4fb88778bfae3a8e319e42ffbcd8aa7f717b6f32bd966dc0da08be3a57a27992d9b90368622e7e2ff0 SHA512 3b9b641bb00b85fa88c87d8923ebcfb844125ff6149b998c565006173f4d68b0ccf8c1fec2c7bac0684584c61176346cee7373b165587a092bcd92ccb96c61db

diff --git a/sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch b/sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch
deleted file mode 100644
index 7907223248ae..000000000000
--- a/sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d2356ebb0084a0d80dbfe33040c9afe938c15d19
-https://bugs.gentoo.org/864717
-
-Fix build w/ glibc 2.36.
-
-From d2356ebb0084a0d80dbfe33040c9afe938c15d19 Mon Sep 17 00:00:00 2001
-From: Martin Liska <mliska@suse.cz>
-Date: Mon, 11 Jul 2022 22:03:14 +0200
-Subject: [PATCH] libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream
-
-9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 [sanitizer] Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36
-
-(cherry picked from commit 2701442d0cf6292f6624443c15813d6d1a3562fe)
---- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
-+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
-@@ -72,7 +72,9 @@
- #include <sys/vt.h>
- #include <linux/cdrom.h>
- #include <linux/fd.h>
-+#if SANITIZER_ANDROID
- #include <linux/fs.h>
-+#endif
- #include <linux/hdreg.h>
- #include <linux/input.h>
- #include <linux/ioctl.h>
-@@ -828,10 +830,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
-   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
-   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
- #endif
--  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
--  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
--  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
--  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
-+  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
-+  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
-+  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
-+  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
-   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
-   unsigned IOCTL_GIO_FONT = GIO_FONT;
-   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;
-

diff --git a/sys-devel/gcc/gcc-11.3.0.ebuild b/sys-devel/gcc/gcc-11.3.0.ebuild
index 93499169999c..88b660dc53f6 100644
--- a/sys-devel/gcc/gcc-11.3.0.ebuild
+++ b/sys-devel/gcc/gcc-11.3.0.ebuild
@@ -4,7 +4,8 @@
 EAPI=7
 
 TOOLCHAIN_PATCH_DEV="sam"
-PATCH_VER="5"
+TOOLCHAIN_PATCH_SUFFIX="xz"
+PATCH_VER="6"
 PATCH_GCC_VER="11.3.0"
 MUSL_VER="1"
 MUSL_GCC_VER="11.3.0"
@@ -19,10 +20,3 @@ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 s
 RDEPEND="elibc_glibc? ( sys-libs/glibc[cet(-)?] )"
 DEPEND="${RDEPEND}"
 BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
-
-src_prepare() {
-	toolchain_src_prepare
-
-	eapply "${FILESDIR}"/${P}-glibc-2.36.patch
-	eapply_user
-}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2022-08-19 18:05 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2022-08-19 18:05 UTC (permalink / raw
  To: gentoo-commits

commit:     42d84bf32472b4cc0d16e81e4ef62e3d3f2fd3a9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 19 17:57:53 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug 19 18:05:18 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42d84bf3

sys-devel/gcc: add glibc 2.36 patch for 11.3.0, 10.4.0

Tried adding to gcc-patches (and indeed did) [0] but got into
a mess and it's not worth the hassle for now.

[0] https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=97ae6391c543891918047f724b0bddecc5f834bc
Closes: https://bugs.gentoo.org/864717
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/gcc/files/gcc-10.4.0-glibc-2.36.patch | 39 +++++++++++++++++++++++
 sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch | 41 +++++++++++++++++++++++++
 sys-devel/gcc/gcc-10.4.0.ebuild                 |  2 ++
 sys-devel/gcc/gcc-11.3.0.ebuild                 |  1 +
 4 files changed, 83 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-10.4.0-glibc-2.36.patch b/sys-devel/gcc/files/gcc-10.4.0-glibc-2.36.patch
new file mode 100644
index 000000000000..e773071188b7
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-10.4.0-glibc-2.36.patch
@@ -0,0 +1,39 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=6bd956e31b2fb6fe1eee4eb1bf309247dcd19b23
+https://bugs.gentoo.org/864717
+
+From 6bd956e31b2fb6fe1eee4eb1bf309247dcd19b23 Mon Sep 17 00:00:00 2001
+From: Martin Liska <mliska@suse.cz>
+Date: Mon, 11 Jul 2022 22:03:14 +0200
+Subject: [PATCH] libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream
+
+9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 [sanitizer] Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36
+
+(cherry picked from commit 2701442d0cf6292f6624443c15813d6d1a3562fe)
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -72,7 +72,9 @@
+ #include <sys/vt.h>
+ #include <linux/cdrom.h>
+ #include <linux/fd.h>
++#if SANITIZER_ANDROID
+ #include <linux/fs.h>
++#endif
+ #include <linux/hdreg.h>
+ #include <linux/input.h>
+ #include <linux/ioctl.h>
+@@ -822,10 +824,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
+   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
+ #endif
+-  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
+-  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
+-  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
+-  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
++  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
++  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
++  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
++  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
+   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
+   unsigned IOCTL_GIO_FONT = GIO_FONT;
+   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;
+

diff --git a/sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch b/sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch
new file mode 100644
index 000000000000..7907223248ae
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch
@@ -0,0 +1,41 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d2356ebb0084a0d80dbfe33040c9afe938c15d19
+https://bugs.gentoo.org/864717
+
+Fix build w/ glibc 2.36.
+
+From d2356ebb0084a0d80dbfe33040c9afe938c15d19 Mon Sep 17 00:00:00 2001
+From: Martin Liska <mliska@suse.cz>
+Date: Mon, 11 Jul 2022 22:03:14 +0200
+Subject: [PATCH] libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream
+
+9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 [sanitizer] Remove #include <linux/fs.h> to resolve fsconfig_command/mount_attr conflict with glibc 2.36
+
+(cherry picked from commit 2701442d0cf6292f6624443c15813d6d1a3562fe)
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -72,7 +72,9 @@
+ #include <sys/vt.h>
+ #include <linux/cdrom.h>
+ #include <linux/fd.h>
++#if SANITIZER_ANDROID
+ #include <linux/fs.h>
++#endif
+ #include <linux/hdreg.h>
+ #include <linux/input.h>
+ #include <linux/ioctl.h>
+@@ -828,10 +830,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
+   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
+ #endif
+-  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
+-  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
+-  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
+-  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
++  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
++  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
++  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
++  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
+   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
+   unsigned IOCTL_GIO_FONT = GIO_FONT;
+   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;
+

diff --git a/sys-devel/gcc/gcc-10.4.0.ebuild b/sys-devel/gcc/gcc-10.4.0.ebuild
index 31a46b613160..311d04b1e636 100644
--- a/sys-devel/gcc/gcc-10.4.0.ebuild
+++ b/sys-devel/gcc/gcc-10.4.0.ebuild
@@ -43,6 +43,8 @@ RDEPEND=""
 BDEPEND="${CATEGORY}/binutils"
 
 src_prepare() {
+	eapply "${FILESDIR}"/${P}-glibc-2.36.patch
+
 	local p upstreamed_patches=(
 		# add them here
 	)

diff --git a/sys-devel/gcc/gcc-11.3.0.ebuild b/sys-devel/gcc/gcc-11.3.0.ebuild
index a90a5c1bc452..93499169999c 100644
--- a/sys-devel/gcc/gcc-11.3.0.ebuild
+++ b/sys-devel/gcc/gcc-11.3.0.ebuild
@@ -23,5 +23,6 @@ BDEPEND=">=${CATEGORY}/binutils-2.30[cet(-)?]"
 src_prepare() {
 	toolchain_src_prepare
 
+	eapply "${FILESDIR}"/${P}-glibc-2.36.patch
 	eapply_user
 }


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2021-11-18  5:25 Sam James
  0 siblings, 0 replies; 19+ messages in thread
From: Sam James @ 2021-11-18  5:25 UTC (permalink / raw
  To: gentoo-commits

commit:     192068fcd5aa14c681bcd90fe28f4bff641599e1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 18 05:22:50 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 18 05:22:50 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=192068fc

sys-devel/gcc: add workaround for cross-compile failure

Bug: https://bugs.gentoo.org/803371
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/gcc-11.2.0-cross-compile-include.patch   | 26 ++++++++++++++++++++++
 sys-devel/gcc/gcc-11.2.0.ebuild                    |  9 ++++++++
 2 files changed, 35 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-11.2.0-cross-compile-include.patch b/sys-devel/gcc/files/gcc-11.2.0-cross-compile-include.patch
new file mode 100644
index 000000000000..d06410650bb0
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-11.2.0-cross-compile-include.patch
@@ -0,0 +1,26 @@
+https://bugs.gentoo.org/803371
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80196
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017
+--- a/configure
++++ b/configure
+@@ -17044,7 +17044,7 @@ else
+ fi
+
+
+-RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
++RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET -nostdinc++"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target ar" >&5
+ $as_echo_n "checking where to find the target ar... " >&6; }
+--- a/configure.ac
++++ b/configure.ac
+@@ -3529,7 +3529,7 @@ ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
+ ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
+ ACX_CHECK_INSTALLED_TARGET_TOOL(WINDMC_FOR_TARGET, windmc)
+
+-RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
++RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET -nostdinc++"
+
+ GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
+ GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
+

diff --git a/sys-devel/gcc/gcc-11.2.0.ebuild b/sys-devel/gcc/gcc-11.2.0.ebuild
index 193f8b813ec4..728de92f4777 100644
--- a/sys-devel/gcc/gcc-11.2.0.ebuild
+++ b/sys-devel/gcc/gcc-11.2.0.ebuild
@@ -11,3 +11,12 @@ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390
 
 RDEPEND=""
 BDEPEND="${CATEGORY}/binutils"
+
+src_prepare() {
+	toolchain_src_prepare
+
+	if is_crosscompile ; then
+		# bug #803371
+		eapply "${FILESDIR}"/gcc-11.2.0-cross-compile-include.patch
+	fi
+}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2020-02-06 19:19 Sergei Trofimovich
  0 siblings, 0 replies; 19+ messages in thread
From: Sergei Trofimovich @ 2020-02-06 19:19 UTC (permalink / raw
  To: gentoo-commits

commit:     066e26c95928de295cf822034de2d2cd05acf8af
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  6 19:19:13 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Feb  6 19:19:30 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=066e26c9

sys-devel/gcc: allow negative insn cost, bug #707958

Apply the patch right on stable ebuild to unblock catalyst builds for ia64.

Reported-by: Matt Turner
Bug: https://bugs.gentoo.org/707958
Package-Manager: Portage-2.3.87, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-devel/gcc/files/gcc-9.2.0-neg-insn-cost.patch | 29 +++++++++++++++++++++++
 sys-devel/gcc/gcc-9.2.0-r2.ebuild                 |  7 +++++-
 sys-devel/gcc/gcc-9.2.0-r3.ebuild                 |  9 ++++++-
 3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/sys-devel/gcc/files/gcc-9.2.0-neg-insn-cost.patch b/sys-devel/gcc/files/gcc-9.2.0-neg-insn-cost.patch
new file mode 100644
index 00000000000..7a6bebdf490
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-9.2.0-neg-insn-cost.patch
@@ -0,0 +1,29 @@
+https://bugs.gentoo.org/707958
+https://gcc.gnu.org/PR88879
+
+Subject: [PATCH] sel-sched: allow negative insn priority (PR 88879)
+From: Alexander Monakov <amonakov@ispras.ru>
+
+	PR rtl-optimization/88879
+	* sel-sched.c (sel_target_adjust_priority): Remove assert.
+
+From-SVN: r271039
+---
+ gcc/ChangeLog   | 5 +++++
+ gcc/sel-sched.c | 2 --
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+--- a/gcc/sel-sched.c
++++ b/gcc/sel-sched.c
+@@ -3331,8 +3331,6 @@ sel_target_adjust_priority (expr_t expr)
+   else
+     new_priority = priority;
+ 
+-  gcc_assert (new_priority >= 0);
+-
+   /* If the priority has changed, adjust EXPR_PRIORITY_ADJ accordingly.  */
+   EXPR_PRIORITY_ADJ (expr) = new_priority - EXPR_PRIORITY (expr);
+ 
+-- 
+2.25.0
+

diff --git a/sys-devel/gcc/gcc-9.2.0-r2.ebuild b/sys-devel/gcc/gcc-9.2.0-r2.ebuild
index e2638f44d60..97327a27655 100644
--- a/sys-devel/gcc/gcc-9.2.0-r2.ebuild
+++ b/sys-devel/gcc/gcc-9.2.0-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="7"
@@ -17,3 +17,8 @@ DEPEND="${RDEPEND}
 if [[ ${CATEGORY} != cross-* ]] ; then
 	PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.13 )"
 fi
+
+src_prepare() {
+	toolchain_src_prepare
+	eapply "${FILESDIR}"/${PN}-9.2.0-neg-insn-cost.patch
+}

diff --git a/sys-devel/gcc/gcc-9.2.0-r3.ebuild b/sys-devel/gcc/gcc-9.2.0-r3.ebuild
index 107ecc45981..398613c13be 100644
--- a/sys-devel/gcc/gcc-9.2.0-r3.ebuild
+++ b/sys-devel/gcc/gcc-9.2.0-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="7"
@@ -14,6 +14,13 @@ DEPEND="${RDEPEND}
 	elibc_glibc? ( >=sys-libs/glibc-2.13 )
 	>=${CATEGORY}/binutils-2.20"
 
+PATCHES=("${FILESDIR}"/${PN}-9.2.0-neg-insn-cost.patch)
+
 if [[ ${CATEGORY} != cross-* ]] ; then
 	PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.13 )"
 fi
+
+src_prepare() {
+	toolchain_src_prepare
+	eapply "${FILESDIR}"/${PN}-9.2.0-neg-insn-cost.patch
+}


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2019-05-03 21:49 Andreas K. Hüttel
  0 siblings, 0 replies; 19+ messages in thread
From: Andreas K. Hüttel @ 2019-05-03 21:49 UTC (permalink / raw
  To: gentoo-commits

commit:     1331a15b06447dda35cf2b71f557c413d0209eb5
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed May  1 22:12:37 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri May  3 21:43:57 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1331a15b

sys-devel/gcc: Dont build 32bit ABIs on riscv, not supported by glibc

Package-Manager: Portage-2.3.64, Repoman-2.3.12
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 sys-devel/gcc/files/gcc-8.3.0-norisc32.patch | 27 +++++++++++++++++++++++++++
 sys-devel/gcc/gcc-8.3.0-r1.ebuild            |  3 ++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/sys-devel/gcc/files/gcc-8.3.0-norisc32.patch b/sys-devel/gcc/files/gcc-8.3.0-norisc32.patch
new file mode 100644
index 00000000000..9315dc44893
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-8.3.0-norisc32.patch
@@ -0,0 +1,27 @@
+diff -ruN gcc-8.3.0.orig/gcc/config/riscv/t-linux-multilib gcc-8.3.0/gcc/config/riscv/t-linux-multilib
+--- gcc-8.3.0.orig/gcc/config/riscv/t-linux-multilib	2017-02-06 22:38:37.000000000 +0100
++++ gcc-8.3.0/gcc/config/riscv/t-linux-multilib	2019-04-28 16:37:44.377841943 +0200
+@@ -20,21 +20,9 @@
+ ilp32d \
+ lp64 \
+ lp64d
+-MULTILIB_REQUIRED = march=rv32imac/mabi=ilp32 \
+-march=rv32imafdc/mabi=ilp32d \
+-march=rv64imac/mabi=lp64 \
++MULTILIB_REQUIRED = march=rv64imac/mabi=lp64 \
+ march=rv64imafdc/mabi=lp64d
+-MULTILIB_REUSE = march.rv32imac/mabi.ilp32=march.rv32ima/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32imaf/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32imafd/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32imafc/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32imafdc/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32g/mabi.ilp32 \
+-march.rv32imac/mabi.ilp32=march.rv32gc/mabi.ilp32 \
+-march.rv32imafdc/mabi.ilp32d=march.rv32imafd/mabi.ilp32d \
+-march.rv32imafdc/mabi.ilp32d=march.rv32gc/mabi.ilp32d \
+-march.rv32imafdc/mabi.ilp32d=march.rv32g/mabi.ilp32d \
+-march.rv64imac/mabi.lp64=march.rv64ima/mabi.lp64 \
++MULTILIB_REUSE = march.rv64imac/mabi.lp64=march.rv64ima/mabi.lp64 \
+ march.rv64imac/mabi.lp64=march.rv64imaf/mabi.lp64 \
+ march.rv64imac/mabi.lp64=march.rv64imafd/mabi.lp64 \
+ march.rv64imac/mabi.lp64=march.rv64imafc/mabi.lp64 \

diff --git a/sys-devel/gcc/gcc-8.3.0-r1.ebuild b/sys-devel/gcc/gcc-8.3.0-r1.ebuild
index 4ccee806e93..26b05fa3555 100644
--- a/sys-devel/gcc/gcc-8.3.0-r1.ebuild
+++ b/sys-devel/gcc/gcc-8.3.0-r1.ebuild
@@ -7,7 +7,7 @@ PATCH_VER="1.1"
 
 inherit toolchain
 
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
 
 RDEPEND=""
 DEPEND="${RDEPEND}
@@ -21,4 +21,5 @@ fi
 src_prepare() {
 	toolchain_src_prepare
 	eapply "${FILESDIR}"/gcc-8.3.0-ia64-bootstrap.patch
+	eapply "${FILESDIR}"/gcc-8.3.0-norisc32.patch
 }


^ permalink raw reply related	[flat|nested] 19+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
@ 2017-11-19 13:40 Andreas Hüttel
  0 siblings, 0 replies; 19+ messages in thread
From: Andreas Hüttel @ 2017-11-19 13:40 UTC (permalink / raw
  To: gentoo-commits

commit:     5075159e68f93318fac08601d175c7ca2e0766ef
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 19 13:40:16 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Nov 19 13:40:34 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5075159e

sys-devel/gcc: Fix build of gcc-4.9.4 by gcc-6.4.0, bug 638056

Solution found by Zorry

Closes: https://bugs.gentoo.org/638056
Package-Manager: Portage-2.3.14, Repoman-2.3.6

 sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch | 66 +++++++++++++++++++++++++++
 sys-devel/gcc/gcc-4.9.4.ebuild                |  5 +-
 2 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch b/sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch
new file mode 100644
index 00000000000..aed1ad0e90b
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch
@@ -0,0 +1,66 @@
+From 41a4aa66eac45c8862a79351647ec06dd03bd1f5 Mon Sep 17 00:00:00 2001
+From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Sat, 13 Dec 2014 11:24:37 +0000
+Subject: [PATCH] 	PR bootstrap/64023 	* Makefile.tpl
+ (EXTRA_TARGET_FLAGS): Set STAGE1_LDFLAGS 	to POSTSTAGE1_LDFLAGS and
+ STAGE1_LIBS to POSTSTAGE1_LIBS. 	Add -B to libstdc++-v3/src/.libs and
+ libstdc++-v3/libsupc++/.libs 	to CXX. 	* Makefile.in: Regenerated.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218705 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ ChangeLog    | 9 +++++++++
+ Makefile.in  | 6 +++++-
+ Makefile.tpl | 6 +++++-
+ 3 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index ba5ae4c2ecb..8ffc313f157 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -835,7 +835,9 @@ EXTRA_TARGET_FLAGS = \
+ 	'AS=$(COMPILER_AS_FOR_TARGET)' \
+ 	'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+ 	'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
+-	'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
++	'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
++	 -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
++	 $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+ 	'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
+ 	'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
+ 	'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+@@ -853,6 +855,8 @@ EXTRA_TARGET_FLAGS = \
+ 	'WINDRES=$$(WINDRES_FOR_TARGET)' \
+ 	'WINDMC=$$(WINDMC_FOR_TARGET)' \
+ 	'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
++	'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
++	'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
+ 	"TFLAGS=$$TFLAGS"
+ 
+ TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
+diff --git a/Makefile.tpl b/Makefile.tpl
+index dcbc6b1b143..bb8227eaafa 100644
+--- a/Makefile.tpl
++++ b/Makefile.tpl
+@@ -641,7 +641,9 @@ EXTRA_TARGET_FLAGS = \
+ 	'AS=$(COMPILER_AS_FOR_TARGET)' \
+ 	'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+ 	'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
+-	'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
++	'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
++	 -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
++	 $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+ 	'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
+ 	'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
+ 	'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+@@ -659,6 +661,8 @@ EXTRA_TARGET_FLAGS = \
+ 	'WINDRES=$$(WINDRES_FOR_TARGET)' \
+ 	'WINDMC=$$(WINDMC_FOR_TARGET)' \
+ 	'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
++	'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
++	'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
+ 	"TFLAGS=$$TFLAGS"
+ 
+ TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
+-- 
+2.15.0
+

diff --git a/sys-devel/gcc/gcc-4.9.4.ebuild b/sys-devel/gcc/gcc-4.9.4.ebuild
index e7562f2330a..44597c4ceec 100644
--- a/sys-devel/gcc/gcc-4.9.4.ebuild
+++ b/sys-devel/gcc/gcc-4.9.4.ebuild
@@ -39,9 +39,12 @@ src_prepare() {
 		EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
 	fi
 
+	# Bug 638056
+	epatch "${FILESDIR}/${P}-bootstrap.patch"
+
 	toolchain_src_prepare
 
 	use vanilla && return 0
-	#Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+	# Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
 	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
 }


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2024-11-19  3:53 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-12  7:40 [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-11-19  3:52 Sam James
2024-06-25  0:11 Sam James
2024-03-07 18:37 Sam James
2024-02-19  5:06 Sam James
2023-10-18 19:33 Sam James
2023-05-16  6:07 Sam James
2023-05-03 12:32 Sam James
2023-04-26 14:14 Sam James
2023-04-17 12:05 Sam James
2023-04-12 13:23 Sam James
2023-04-12  7:35 Sam James
2023-04-05  1:18 Sam James
2022-08-22  1:41 Sam James
2022-08-19 18:05 Sam James
2021-11-18  5:25 Sam James
2020-02-06 19:19 Sergei Trofimovich
2019-05-03 21:49 Andreas K. Hüttel
2017-11-19 13:40 Andreas Hüttel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox