summaryrefslogtreecommitdiff
path: root/sys-devel/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel/gcc')
-rw-r--r--sys-devel/gcc/Manifest2
-rw-r--r--sys-devel/gcc/files/gcc-14.1.0-emacs-PR114965.patch106
-rw-r--r--sys-devel/gcc/gcc-14.1.0-r1.ebuild54
3 files changed, 162 insertions, 0 deletions
diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index 18b1ad60e37f..e8a26f91f230 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -1,4 +1,5 @@
AUX gcc-13-fix-cross-fixincludes.patch 854 BLAKE2B 3dc52dc6b1ed7e86ae5a0a48b79dc5020f2abcbb4db6735479595ce88e259eb8fe933a5619408a29997c00966481f5b3cd3a412eb63517aa26b6babb3afac612 SHA512 666f9343594c5ffa4ea01e7cbfb8c79d95ffc3a5215dbc16a3f964cb73de552863aa578758d2ffcb0dfd36764ec65389b5abacf6dd12c941c129f39c8117fff2
+AUX gcc-14.1.0-emacs-PR114965.patch 3652 BLAKE2B 8b7a072607a81e02ee8a624615acd2248b101bf157c46d2648a3e6e9f1269bf3dd8ca60d63094945e2dbe58027a1489ab2987cd90e1818bcc451ce82e39a544c SHA512 a9f2a8ae26a584945e352755dbcf29f7ea1424f9d89da39d79070519dcdc207814703f3840030ba02132f6b0c3db64a3ddf5027918adb50e135418e44b2d718f
AUX gcc-configure-texinfo.patch 341 BLAKE2B d2ea3b2ea08f5d3a498ba27d0fb95e325097e2104e55caa28b66515cb48662649140d90b639369aedc54b2b1178fa4b49cda442f5f504e09d88a2efa45a5057c SHA512 e8d34c5077409df5495cf0c5fbf5e77f841c5698108fa6a5fde33eb28202c685603bdefd8368918e55f30c4b995e895d71d64c715c1ec2b017e09eb2c54c09ff
DIST gcc-10.5.0-musl-patches-2.tar.xz 3452 BLAKE2B 5387e516d07d81477b3f39b8b3bd986bf861d32cd25dc5481c97bd3620d00c918c5661e86857f66dbf28a655401a53e43417f638c443e44cbfdbf5e950caac4d SHA512 86f2ce31cc4fc4fb5a6043fb527bf822d895e1a6220652024f78a1cbd5a962edb6be8dc5f43c32053e075f39bb2350ea8f14e7d57e0473dd2933a7b44676bde5
DIST gcc-10.5.0-patches-6.tar.xz 18208 BLAKE2B 4cac3340108fb378c76ad62b728429f3c97f348d178744e7536575f3576ca8aa682b878b7df3b1c162dccae64a3cb56c66d8d60eae323e1ece2de4278084fdbd SHA512 9d6c84325fbc118cee01347468ce729c278e5b026b16da945fe54050726e26f86a46ee7b71a01a47cf927b70bfcce459c49a6bc4fb93dcfaa047c76d4c5bc5bc
@@ -44,6 +45,7 @@ EBUILD gcc-13.2.1_p20240503.ebuild 1726 BLAKE2B 381a6cd5d60a1e4ac9016198f69d1910
EBUILD gcc-13.3.9999.ebuild 1635 BLAKE2B 06b81b06457d409fa4d837adb5e7d60c207546c115916a3ade51d4ec18dee9985b5b3aeb0f811ce9fd1bec29afcc91298110c33ab604ca44ce86c151e41d2037 SHA512 47e978a337c2073c19574cc7697665bcc62480258dd01ceaf105d14221d10473e8755eb1d7f53096cd6ed03fa11aa0a14a7cae42271b38a423d9cdf950b9a942
EBUILD gcc-14.0.1_pre20240430.ebuild 1720 BLAKE2B 825a9920c30aae378c3558146c2b98a9561c3c94a75395883e2b619ab4500feb47e692f1f1ee082067d692ab9b01bd94981af15ae5afcc3573568388c6eacd2b SHA512 d1852d3b482279ba20da06b62735fa297d2334896515e6555647c47c1cbe9c7a72b1817e423500e6a67d35a455dd8d2856bfad41909933299f43b759ac456201
EBUILD gcc-14.0.1_pre20240503.ebuild 1720 BLAKE2B 825a9920c30aae378c3558146c2b98a9561c3c94a75395883e2b619ab4500feb47e692f1f1ee082067d692ab9b01bd94981af15ae5afcc3573568388c6eacd2b SHA512 d1852d3b482279ba20da06b62735fa297d2334896515e6555647c47c1cbe9c7a72b1817e423500e6a67d35a455dd8d2856bfad41909933299f43b759ac456201
+EBUILD gcc-14.1.0-r1.ebuild 1475 BLAKE2B e25b99917c998a17ff7634bccf4fd1b133bc56f0346e39e6851bbb75f20c859895bf99af4dfd1decc3a8e4c1bd9bd96ef0df4df82e84a62b5b7bb06f2383cd1f SHA512 9dc820ac2f40f75550ddc8a404afbedfe273b0c6368c62161aa53e26e4f0e195bd1ecdbd4d21f8ca21fdfd2a7b483928a2d64ed67f08ab9391d94e536e09b8fb
EBUILD gcc-14.1.0.ebuild 1421 BLAKE2B 058366274ed328844e97c6071519375252397425c04619b1dfc50fd9e917769092dc1f42277625f969e5b45b7476b30115abcda321f3285db784b7f6a4d492e4 SHA512 dd6fc016e3019e2675f8a019cff5f5cba7f7933d3155693926a507cf3d71e2b030e683d07a25890696b2a568efe89a5d8e1fdd88cdce865b661628e8f1ce6397
EBUILD gcc-14.1.9999.ebuild 1394 BLAKE2B 6a8bef5a0638de6ddbc1126ffbc1af934d95243575a20bfa8dd6eb9f5c03572e1b8019d9439e7c59c4fa208373073a083796536694205967240c257b37f9d2ce SHA512 22c1e9406ee605d82e40fd0f34b538d09b4aacdd12f43f782ad23d915ea08e579bb67758b4500e1f7fc78fdf546203f4913250acecfff342748ef30ec433bd08
EBUILD gcc-15.0.0_pre20240428.ebuild 1402 BLAKE2B 9fa3487167283d7c6fe3f45dcf92bc5895bd261554dd5238fb42f0477de509e6d8843378831a0a2498827dbcd4b1cc887266292e2f30d80e4884761b654a94e5 SHA512 c6e5f95caa03472a0f030f8a0d84c29b226eadbb28bd542baca56dbe9b03121f1bfbe52a42d7b2700be00412b8b6f0d40292520352cbe25ac27114856f4a8e11
diff --git a/sys-devel/gcc/files/gcc-14.1.0-emacs-PR114965.patch b/sys-devel/gcc/files/gcc-14.1.0-emacs-PR114965.patch
new file mode 100644
index 000000000000..df4fcee90c51
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-14.1.0-emacs-PR114965.patch
@@ -0,0 +1,106 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d54151df3ba0ee3203e0b8cb8f8fcd168a766c51
+https://gcc.gnu.org/PR114965
+
+From d54151df3ba0ee3203e0b8cb8f8fcd168a766c51 Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Wed, 8 May 2024 10:17:32 +0200
+Subject: [PATCH] reassoc: Fix up optimize_range_tests_to_bit_test [PR114965]
+
+The optimize_range_tests_to_bit_test optimization normally emits a range
+test first:
+ if (entry_test_needed)
+ {
+ tem = build_range_check (loc, optype, unshare_expr (exp),
+ false, lowi, high);
+ if (tem == NULL_TREE || is_gimple_val (tem))
+ continue;
+ }
+so during the bit test we already know that exp is in the [lowi, high]
+range, but skips it if we have range info which tells us this isn't
+necessary.
+Also, normally it emits shifts by exp - lowi counter, but has an
+optimization to use just exp counter if the mask isn't a more expensive
+constant in that case and lowi is > 0 and high is smaller than prec.
+
+The following testcase is miscompiled because the two abnormal cases
+are triggered. The range of exp is [43, 43][48, 48][95, 95], so we on
+64-bit arch decide we don't need the entry test, because 95 - 43 < 64.
+And we also decide to use just exp as counter, because the range test
+tests just for exp == 43 || exp == 48, so high is smaller than 64 too.
+Because 95 is in the exp range, we can't do that, we'd either need to
+do a range test first, i.e.
+if (exp - 43U <= 48U - 43U) if ((1UL << exp) & mask1))
+or need to subtract lowi from the shift counter, i.e.
+if ((1UL << (exp - 43)) & mask2)
+but can't do both unless r.upper_bound () is < prec.
+
+The following patch ensures that.
+
+2024-05-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/114965
+ * tree-ssa-reassoc.cc (optimize_range_tests_to_bit_test): Don't try to
+ optimize away exp - lowi subtraction from shift count unless entry
+ test is emitted or unless r.upper_bound () is smaller than prec.
+
+ * gcc.c-torture/execute/pr114965.c: New test.
+
+(cherry picked from commit 9adec2d91e62a479474ae79df5b455fd4b8463ba)
+---
+ .../gcc.c-torture/execute/pr114965.c | 30 +++++++++++++++++++
+ gcc/tree-ssa-reassoc.cc | 3 +-
+ 2 files changed, 32 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr114965.c
+
+diff --git a/gcc/testsuite/gcc.c-torture/execute/pr114965.c b/gcc/testsuite/gcc.c-torture/execute/pr114965.c
+new file mode 100644
+index 000000000000..89d68e187015
+--- /dev/null
++++ b/gcc/testsuite/gcc.c-torture/execute/pr114965.c
+@@ -0,0 +1,30 @@
++/* PR tree-optimization/114965 */
++
++static void
++foo (const char *x)
++{
++
++ char a = '0';
++ while (1)
++ {
++ switch (*x)
++ {
++ case '_':
++ case '+':
++ a = *x;
++ x++;
++ continue;
++ default:
++ break;
++ }
++ break;
++ }
++ if (a == '0' || a == '+')
++ __builtin_abort ();
++}
++
++int
++main ()
++{
++ foo ("_");
++}
+diff --git a/gcc/tree-ssa-reassoc.cc b/gcc/tree-ssa-reassoc.cc
+index 61f54f07b577..556ecdebe2d7 100644
+--- a/gcc/tree-ssa-reassoc.cc
++++ b/gcc/tree-ssa-reassoc.cc
+@@ -3418,7 +3418,8 @@ optimize_range_tests_to_bit_test (enum tree_code opcode, int first, int length,
+ We can avoid then subtraction of the minimum value, but the
+ mask constant could be perhaps more expensive. */
+ if (compare_tree_int (lowi, 0) > 0
+- && compare_tree_int (high, prec) < 0)
++ && compare_tree_int (high, prec) < 0
++ && (entry_test_needed || wi::ltu_p (r.upper_bound (), prec)))
+ {
+ int cost_diff;
+ HOST_WIDE_INT m = tree_to_uhwi (lowi);
+--
+2.39.3
diff --git a/sys-devel/gcc/gcc-14.1.0-r1.ebuild b/sys-devel/gcc/gcc-14.1.0-r1.ebuild
new file mode 100644
index 000000000000..bf8cde2986d2
--- /dev/null
+++ b/sys-devel/gcc/gcc-14.1.0-r1.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"
+PATCH_GCC_VER="14.1.0"
+PATCH_VER="1"
+MUSL_VER="1"
+MUSL_GCC_VER="14.1.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=releases/gcc-$(ver_cut 1)
+elif [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+ # Don't keyword live ebuilds
+ #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="amd64? ( >=${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}"/gcc-14.1.0-emacs-PR114965.patch
+ eapply_user
+}