From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9AB531582EF for ; Mon, 03 Mar 2025 19:40:46 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 82DE33430CB for ; Mon, 03 Mar 2025 19:40:46 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 7EE311102D0; Mon, 03 Mar 2025 19:40:45 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 749151102D0 for ; Mon, 03 Mar 2025 19:40:45 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2468E343018 for ; Mon, 03 Mar 2025 19:40:45 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7A9702729 for ; Mon, 03 Mar 2025 19:40:43 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1741030686.63e64e3e76dcbc5ea1678ab5ad2d2b4a62c656cf.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-devel/gcc/files/gcc-15.0.1_pre20250302-firefox-ice.patch sys-devel/gcc/files/gcc-15.0.1_pre20250302-firefox-pgo-ice.patch sys-devel/gcc/gcc-15.0.1_pre20250302-r1.ebuild X-VCS-Directories: sys-devel/gcc/ sys-devel/gcc/files/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 63e64e3e76dcbc5ea1678ab5ad2d2b4a62c656cf X-VCS-Branch: master Date: Mon, 03 Mar 2025 19:40:43 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: fb0e622a-0eeb-41ca-af84-083d9b568bbe X-Archives-Hash: 21644a4d09bbfbac4e32242316c93bb7 commit: 63e64e3e76dcbc5ea1678ab5ad2d2b4a62c656cf Author: Sam James gentoo org> AuthorDate: Mon Mar 3 19:38:06 2025 +0000 Commit: Sam James gentoo org> CommitDate: Mon Mar 3 19:38:06 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=63e64e3e sys-devel/gcc: fix two Firefox issues w/ GCC 15 * Fix ICE when building Firefox with PGO (PR118318). The patch isn't yet applied upstream but it's simple and an additional safety-check so shouldn't cause wrong-code (at worst, it's too pessimistic and could hurt performance a bit, rather than anything else). * Fix ICE when building Firefox without -march=XXX combined with LTO (PR119067). I only hit this when building manually without -march=XXX. Never hit it with the ebuild. Bug: https://gcc.gnu.org/PR118318 Bug: https://gcc.gnu.org/PR119067 Signed-off-by: Sam James gentoo.org> .../files/gcc-15.0.1_pre20250302-firefox-ice.patch | 99 ++++++++++++++++++++++ .../gcc-15.0.1_pre20250302-firefox-pgo-ice.patch | 58 +++++++++++++ sys-devel/gcc/gcc-15.0.1_pre20250302-r1.ebuild | 54 ++++++++++++ 3 files changed, 211 insertions(+) diff --git a/sys-devel/gcc/files/gcc-15.0.1_pre20250302-firefox-ice.patch b/sys-devel/gcc/files/gcc-15.0.1_pre20250302-firefox-ice.patch new file mode 100644 index 000000000000..6fbc91e926b1 --- /dev/null +++ b/sys-devel/gcc/files/gcc-15.0.1_pre20250302-firefox-ice.patch @@ -0,0 +1,99 @@ +https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f22e89167b3abfbf6d67f42fc4d689d8ffdc1810 +https://gcc.gnu.org/PR119067 + +From f22e89167b3abfbf6d67f42fc4d689d8ffdc1810 Mon Sep 17 00:00:00 2001 +From: Richard Biener +Date: Mon, 3 Mar 2025 09:54:15 +0100 +Subject: [PATCH] ipa/119067 - bogus TYPE_PRECISION check on VECTOR_TYPE + +odr_types_equivalent_p can end up using TYPE_PRECISION on vector +types which is a no-go. The following instead uses TYPE_VECTOR_SUBPARTS +for vector types so we also end up comparing the number of vector elements. + + PR ipa/119067 + * ipa-devirt.cc (odr_types_equivalent_p): Check + TYPE_VECTOR_SUBPARTS for vectors. + + * g++.dg/lto/pr119067_0.C: New testcase. + * g++.dg/lto/pr119067_1.C: Likewise. +--- + gcc/ipa-devirt.cc | 10 +++++++++- + gcc/testsuite/g++.dg/lto/pr119067_0.C | 22 ++++++++++++++++++++++ + gcc/testsuite/g++.dg/lto/pr119067_1.C | 10 ++++++++++ + 3 files changed, 41 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/g++.dg/lto/pr119067_0.C + create mode 100644 gcc/testsuite/g++.dg/lto/pr119067_1.C + +diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc +index c31658f57ef2..532e25e87c60 100644 +--- a/gcc/ipa-devirt.cc ++++ b/gcc/ipa-devirt.cc +@@ -1259,13 +1259,21 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, + || TREE_CODE (t1) == OFFSET_TYPE + || POINTER_TYPE_P (t1)) + { +- if (TYPE_PRECISION (t1) != TYPE_PRECISION (t2)) ++ if (!VECTOR_TYPE_P (t1) && TYPE_PRECISION (t1) != TYPE_PRECISION (t2)) + { + warn_odr (t1, t2, NULL, NULL, warn, warned, + G_("a type with different precision is defined " + "in another translation unit")); + return false; + } ++ if (VECTOR_TYPE_P (t1) ++ && maybe_ne (TYPE_VECTOR_SUBPARTS (t1), TYPE_VECTOR_SUBPARTS (t2))) ++ { ++ warn_odr (t1, t2, NULL, NULL, warn, warned, ++ G_("a vector type with different number of elements " ++ "is defined in another translation unit")); ++ return false; ++ } + if (TYPE_UNSIGNED (t1) != TYPE_UNSIGNED (t2)) + { + warn_odr (t1, t2, NULL, NULL, warn, warned, +diff --git a/gcc/testsuite/g++.dg/lto/pr119067_0.C b/gcc/testsuite/g++.dg/lto/pr119067_0.C +new file mode 100644 +index 000000000000..e0f813ceffed +--- /dev/null ++++ b/gcc/testsuite/g++.dg/lto/pr119067_0.C +@@ -0,0 +1,22 @@ ++/* { dg-lto-do link } */ ++/* { dg-skip-if "" { ! { x86_64-*-* i?86-*-* } } } */ ++/* { dg-require-effective-target avx2 } */ ++/* { dg-require-effective-target shared } */ ++/* { dg-lto-options { { -O2 -fPIC -flto } } } */ ++/* { dg-extra-ld-options { -shared } } */ ++ ++#pragma GCC push_options ++#pragma GCC target("avx2") ++typedef char __v32qi __attribute__ ((__vector_size__ (32))); ++struct ff ++{ ++ __v32qi t; ++}; ++__v32qi g(struct ff a); ++ ++__v32qi h(__v32qi a) ++{ ++ struct ff t = {a}; ++ return g(t); ++} ++#pragma GCC pop_options +diff --git a/gcc/testsuite/g++.dg/lto/pr119067_1.C b/gcc/testsuite/g++.dg/lto/pr119067_1.C +new file mode 100644 +index 000000000000..d8e2935fa24d +--- /dev/null ++++ b/gcc/testsuite/g++.dg/lto/pr119067_1.C +@@ -0,0 +1,10 @@ ++/* { dg-options "-mavx2" } */ ++ ++typedef char __v32qi __attribute__ ((__vector_size__ (32))); ++struct ff ++{ ++ __v32qi t; ++}; ++__v32qi g(struct ff a) { ++ return a.t; ++} +-- +2.43.5 diff --git a/sys-devel/gcc/files/gcc-15.0.1_pre20250302-firefox-pgo-ice.patch b/sys-devel/gcc/files/gcc-15.0.1_pre20250302-firefox-pgo-ice.patch new file mode 100644 index 000000000000..9486b69147d3 --- /dev/null +++ b/sys-devel/gcc/files/gcc-15.0.1_pre20250302-firefox-pgo-ice.patch @@ -0,0 +1,58 @@ +https://inbox.sourceware.org/gcc-patches/ri6bjui45il.fsf@virgil.suse.cz/ + +From 833d679c3c071b78dfb22015fe03d2cecfd650ec Mon Sep 17 00:00:00 2001 +Message-ID: <833d679c3c071b78dfb22015fe03d2cecfd650ec.1741019831.git.sam@gentoo.org> +From: Martin Jambor +Date: Mon, 3 Mar 2025 14:18:10 +0100 +Subject: [PATCH] ipa-cp: Avoid ICE when redistributing nodes among edges to + recursive clones (PR 118318) + +Hi, + +PR 118318 reported an ICE during PGO build of Firefox when IPA-CP, in +the final stages of update_counts_for_self_gen_clones where it +attempts to guess how to distribute profile count among clones created +for recursive edges and the various edges that are created in the +process. If one such edge has profile count of kind GUESSED_GLOBAL0, +the compatibility check in the operator+ will lead to an ICE. After +discussing the situation with Honza, we concluded that there is little +more we can do other than check for this situation before touching the +edge count, so this is what this patch does. + +Bootstrapped and LTO-profile-bootstrapped and tested on x86_64. OK for +master? (Should I then backport this to active release branches? I +guess it would make sense.) + +Thanks, + +Martin + +gcc/ChangeLog: + +2025-02-28 Martin Jambor + +PR ipa/118318 + * ipa-cp.cc (adjust_clone_incoming_counts): Add a compatible_p check. +--- + gcc/ipa-cp.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc +index 3c994f24f540..264568989a96 100644 +--- a/gcc/ipa-cp.cc ++++ b/gcc/ipa-cp.cc +@@ -4638,7 +4638,8 @@ adjust_clone_incoming_counts (cgraph_node *node, + cs->count = cs->count.combine_with_ipa_count (sum); + } + else if (!desc->processed_edges->contains (cs) +- && cs->caller->clone_of == desc->orig) ++ && cs->caller->clone_of == desc->orig ++ && cs->count.compatible_p (desc->count)) + { + cs->count += desc->count; + if (dump_file) + +base-commit: f1c30c6213fb228f1e8b5973d10c868b834a4acd +-- +2.48.1 + diff --git a/sys-devel/gcc/gcc-15.0.1_pre20250302-r1.ebuild b/sys-devel/gcc/gcc-15.0.1_pre20250302-r1.ebuild new file mode 100644 index 000000000000..290862949c1d --- /dev/null +++ b/sys-devel/gcc/gcc-15.0.1_pre20250302-r1.ebuild @@ -0,0 +1,54 @@ +# Copyright 1999-2025 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="46" +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}-firefox-ice.patch + eapply "${FILESDIR}"/${P}-firefox-pgo-ice.patch + eapply_user +}