summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-05-16 07:07:12 +0100
committerSam James <sam@gentoo.org>2023-05-16 07:07:20 +0100
commit0290ec871c3c59716cdf7718bbee1cef1b86ec43 (patch)
tree2343bcdb7dc6ab8d070b4086eab7d79ba3fc9ceb
parentmedia-gfx/entice: drop 0_pre20210919-r1 (diff)
downloadgentoo-0290ec871c3c59716cdf7718bbee1cef1b86ec43.tar.gz
gentoo-0290ec871c3c59716cdf7718bbee1cef1b86ec43.tar.bz2
gentoo-0290ec871c3c59716cdf7718bbee1cef1b86ec43.zip
sys-devel/gcc: backport ccache ICE fix for 12.3*
Bug: https://bugs.gentoo.org/906310 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--sys-devel/gcc/files/gcc-12.3-ccache-ICE.patch67
-rw-r--r--sys-devel/gcc/gcc-12.3.1_p20230512-r1.ebuild57
2 files changed, 124 insertions, 0 deletions
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
+}