diff options
Diffstat (limited to 'sys-devel/gcc')
3 files changed, 278 insertions, 0 deletions
diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest index efec624dcd41..f7d9cbe81692 100644 --- a/sys-devel/gcc/Manifest +++ b/sys-devel/gcc/Manifest @@ -1,3 +1,4 @@ +AUX gcc-13.0.1_pre20230326-76_all_all_PR109265_PR109274_PR109325_range_def_chain.patch 6907 BLAKE2B 3fcbedc9b330207972a17d5b48a307911b0a94ec0f2a0e9bc22b39f8c7ca0cf0709afbf2af69d7d8596393ad163db043848c2f3cc9352060a4cb1bb4f673fa92 SHA512 a5988d63a182eda8da6cb95269e9474323b5681cba7d91f1dae71fb914ff0b210fac092d94e4427c8065e0a44cd1e4b96de08fd0267eeda88dd0ba96c556c742 AUX gcc-configure-LANG.patch 2052 BLAKE2B 28c36f4992e41305ee421dade5eaaac34e3bdc523665b03f360f2bc01e8f69e9dc48052edb80dece63ab561e80325b4f125502482eb16f7324f1c03670021550 SHA512 a694c7ac2f45cc657097ff5b0cf1356ac88a9c06035c9ba15167e9d444844d0d8a478eb1b9b62195dd063774f79697b9148b9cdb6c261640b472c291061b2129 AUX gcc-configure-texinfo.patch 341 BLAKE2B d2ea3b2ea08f5d3a498ba27d0fb95e325097e2104e55caa28b66515cb48662649140d90b639369aedc54b2b1178fa4b49cda442f5f504e09d88a2efa45a5057c SHA512 e8d34c5077409df5495cf0c5fbf5e77f841c5698108fa6a5fde33eb28202c685603bdefd8368918e55f30c4b995e895d71d64c715c1ec2b017e09eb2c54c09ff DIST gcc-10-20230119.tar.xz 72112952 BLAKE2B 6e28cba9f6ff5c9f9231828bb400c82b8658a4f9c0166c28a6a12d71728d4460904152a8c84bbeff88c06b7f9378937b7b61bf4a871a10c56bd005170dc5fde2 SHA512 6cbb567ef1da1b6fa65892b6e71c3b7cd37e0c483e049720ea1987d444a0e7b4eb15d1e99f4e35995acdce560a811a779574eeba52bb252c61325accedd6a5c5 @@ -55,6 +56,7 @@ EBUILD gcc-12.3.9999.ebuild 1593 BLAKE2B 0cac4b67933abbacf0037f3e89b4209ea2a8147 EBUILD gcc-13.0.1.9999.ebuild 1307 BLAKE2B 71019cdeaf209a3c82cb4c6c2a4d6827f027da17073f359d762cca422b2f67cd127b43b184a26b0d6a3ce5b83d92270b0a5ab6d832c31e28619dec9b5f4fff8a SHA512 5e4faf9e4e1cdb5683c7e66d270910c7f36a6c4504faf3810a562fac93513e20ca9b98dfe7b7a7441c9dffffc01c861609545fc7e36fe7a8081b636adc290dfc EBUILD gcc-13.0.1_pre20230312-r1.ebuild 1354 BLAKE2B b1dcf92771940c65b4862f76107df49bdc811c279fa33205cc63d8ed74ceed786712e42a7c050e691a30494b3b55c7bcf62e14d7baa2550c392b7d0bac0007d0 SHA512 4e49f8ea0487bd4cf57a2518647e1dc1f82e1b891a200463f2c17f6285b67070abd1d732ef2c578389a927f142495b3f721a6017f211684b27a3f5ce903cd774 EBUILD gcc-13.0.1_pre20230319.ebuild 1354 BLAKE2B b1dcf92771940c65b4862f76107df49bdc811c279fa33205cc63d8ed74ceed786712e42a7c050e691a30494b3b55c7bcf62e14d7baa2550c392b7d0bac0007d0 SHA512 4e49f8ea0487bd4cf57a2518647e1dc1f82e1b891a200463f2c17f6285b67070abd1d732ef2c578389a927f142495b3f721a6017f211684b27a3f5ce903cd774 +EBUILD gcc-13.0.1_pre20230326-r1.ebuild 1441 BLAKE2B cb7296081107856f2d0a9ead3a75f23568bbada71037e897e63de946111fabff4ec79ed2495ed112c8ec6475c5292d01206957a989368fc0198a433048c6b536 SHA512 d8db51c7b7ee655caa0f528a167d043d34bac9bdeb7873893354ead0c5466b82c5af4389571fdcf8cee9e26b0960d3c6e84f7ff366d2384232d7bc9f16376fed EBUILD gcc-13.0.1_pre20230326.ebuild 1354 BLAKE2B b1dcf92771940c65b4862f76107df49bdc811c279fa33205cc63d8ed74ceed786712e42a7c050e691a30494b3b55c7bcf62e14d7baa2550c392b7d0bac0007d0 SHA512 4e49f8ea0487bd4cf57a2518647e1dc1f82e1b891a200463f2c17f6285b67070abd1d732ef2c578389a927f142495b3f721a6017f211684b27a3f5ce903cd774 EBUILD gcc-8.5.0-r1.ebuild 498 BLAKE2B e24f62fdb50bf2e9957cbb85c72adc96d369938a7f552735772de964f7023b8b34bd11e7e544d268cc308e25272084a728bd061f37c568d42ea65d55bb2a2e93 SHA512 f35b353e9f54eb3e1c6f8e0ea262458b41da9bddb993793aff79f765c4d93811744979d34e50c6470a9b2cfb63b7006bd284d819b7a98e56a8b3a34ae570ae76 EBUILD gcc-9.5.0.ebuild 844 BLAKE2B 719c259a6f39c72f7d1748095a9e649d4ab3dde04b118125313ab9b915eb9cbd038592532185317080dbc46d73a8bd324b498462db73b12d23144cd58378dd9c SHA512 1ed19c79239d155be3b267fcad4d7230821406ba8fb2c11857168fc0e717c4edcd8d7fb0972bc6df0fbcfbd8a9f085aa023f452368278c0e7e0af014c1124d89 diff --git a/sys-devel/gcc/files/gcc-13.0.1_pre20230326-76_all_all_PR109265_PR109274_PR109325_range_def_chain.patch b/sys-devel/gcc/files/gcc-13.0.1_pre20230326-76_all_all_PR109265_PR109274_PR109325_range_def_chain.patch new file mode 100644 index 000000000000..bd66ce422cff --- /dev/null +++ b/sys-devel/gcc/files/gcc-13.0.1_pre20230326-76_all_all_PR109265_PR109274_PR109325_range_def_chain.patch @@ -0,0 +1,219 @@ +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109265 +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109274 +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109325 +https://bugs.gentoo.org/903505 +https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=dd63bba0c8dc3a6ae06cfdc084bca7c68b8bbd39 + +From dd63bba0c8dc3a6ae06cfdc084bca7c68b8bbd39 Mon Sep 17 00:00:00 2001 +From: Andrew MacLeod <amacleod@redhat.com> +Date: Fri, 24 Mar 2023 11:21:20 -0400 +Subject: [PATCH] Fix compute_operand when op1 == op2 symbolically. + +First, class value_relation should not sanitize records. just create +what is asked. + +Second., if there is not a relation record, compute_operand was +creating one for op1 == op2 if op1 and op2 were the same symbol. This +is not the correct way to communicate the information, as that record +will continue to be passed along the GORI unwind chain. + +Instead, simply pass that information locally to the opX_range routine +for only the current statement. + + PR tree-optimization/109265 + PR tree-optimization/109274 + gcc/ + * gimple-range-gori.cc (gori_compute::compute_operand_range): Do + not create a relation record is op1 and op2 are the same symbol. + (gori_compute::compute_operand1_range): Pass op1 == op2 to the + handler for this stmt, but create a new record only if this statement + generates a relation based on the ranges. + (gori_compute::compute_operand2_range): Ditto. + * value-relation.h (value_relation::set_relation): Always create the + record that is requested. + + gcc/testsuite/ + * gcc.dg/pr109274.c: New. + * gfortran.dg/pr109265.f90: New. +--- a/gcc/gimple-range-gori.cc ++++ b/gcc/gimple-range-gori.cc +@@ -623,21 +623,6 @@ gori_compute::compute_operand_range (vrange &r, gimple *stmt, + tree op1 = gimple_range_ssa_p (handler.operand1 ()); + tree op2 = gimple_range_ssa_p (handler.operand2 ()); + +- // If there is a relation, use it instead of any passed in. This will allow +- // multiple relations to be processed in compound logicals. +- if (op1 && op2) +- { +- relation_kind k = handler.op1_op2_relation (lhs); +- // If there is no relation, and op1 == op2, create a relation. +- if (!vrel_ptr && k == VREL_VARYING && op1 == op2) +- k = VREL_EQ; +- if (k != VREL_VARYING) +- { +- vrel.set_relation (k, op1, op2); +- vrel_ptr = &vrel; +- } +- } +- + // Handle end of lookup first. + if (op1 == name) + return compute_operand1_range (r, handler, lhs, name, src, vrel_ptr); +@@ -1093,6 +1078,7 @@ gori_compute::compute_operand1_range (vrange &r, + const vrange &lhs, tree name, + fur_source &src, value_relation *rel) + { ++ value_relation local_rel; + gimple *stmt = handler.stmt (); + tree op1 = handler.operand1 (); + tree op2 = handler.operand2 (); +@@ -1101,6 +1087,7 @@ gori_compute::compute_operand1_range (vrange &r, + relation_trio trio; + if (rel) + trio = rel->create_trio (lhs_name, op1, op2); ++ relation_kind op_op = trio.op1_op2 (); + + Value_Range op1_range (TREE_TYPE (op1)); + Value_Range tmp (TREE_TYPE (op1)); +@@ -1113,10 +1100,26 @@ gori_compute::compute_operand1_range (vrange &r, + if (op2) + { + src.get_operand (op2_range, op2); +- relation_kind op_op = trio.op1_op2 (); ++ ++ // If there is a relation betwen op1 and op2, use it instead. ++ // This allows multiple relations to be processed in compound logicals. ++ if (gimple_range_ssa_p (op1) && gimple_range_ssa_p (op2)) ++ { ++ relation_kind k = handler.op1_op2_relation (lhs); ++ if (k != VREL_VARYING) ++ { ++ op_op = k; ++ local_rel.set_relation (op_op, op1, op2); ++ rel = &local_rel; ++ } ++ } ++ + if (op_op != VREL_VARYING) + refine_using_relation (op1, op1_range, op2, op2_range, src, op_op); + ++ // If op1 == op2, create a new trio for just this call. ++ if (op1 == op2 && gimple_range_ssa_p (op1)) ++ trio = relation_trio (trio.lhs_op1 (), trio.lhs_op2 (), VREL_EQ); + if (!handler.calc_op1 (tmp, lhs, op2_range, trio)) + return false; + } +@@ -1185,6 +1188,7 @@ gori_compute::compute_operand2_range (vrange &r, + const vrange &lhs, tree name, + fur_source &src, value_relation *rel) + { ++ value_relation local_rel; + gimple *stmt = handler.stmt (); + tree op1 = handler.operand1 (); + tree op2 = handler.operand2 (); +@@ -1201,9 +1205,26 @@ gori_compute::compute_operand2_range (vrange &r, + if (rel) + trio = rel->create_trio (lhs_name, op1, op2); + relation_kind op_op = trio.op1_op2 (); ++ ++ // If there is a relation betwen op1 and op2, use it instead. ++ // This allows multiple relations to be processed in compound logicals. ++ if (gimple_range_ssa_p (op1) && gimple_range_ssa_p (op2)) ++ { ++ relation_kind k = handler.op1_op2_relation (lhs); ++ if (k != VREL_VARYING) ++ { ++ op_op = k; ++ local_rel.set_relation (op_op, op1, op2); ++ rel = &local_rel; ++ } ++ } ++ + if (op_op != VREL_VARYING) + refine_using_relation (op1, op1_range, op2, op2_range, src, op_op); + ++ // If op1 == op2, create a new trio for this stmt. ++ if (op1 == op2 && gimple_range_ssa_p (op1)) ++ trio = relation_trio (trio.lhs_op1 (), trio.lhs_op2 (), VREL_EQ); + // Intersect with range for op2 based on lhs and op1. + if (!handler.calc_op2 (tmp, lhs, op1_range, trio)) + return false; +--- /dev/null ++++ b/gcc/testsuite/gcc.dg/pr109274.c +@@ -0,0 +1,16 @@ ++/* PR tree-optimization/109274 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2 " } */ ++ ++float a, b, c; ++int d; ++float bar (void); ++ ++void ++foo (void) ++{ ++ a = 0 * -(2.0f * c); ++ d = a != a ? 0 : bar (); ++ b = c; ++} ++ +--- /dev/null ++++ b/gcc/testsuite/gfortran.dg/pr109265.f90 +@@ -0,0 +1,39 @@ ++! PR tree-optimization/109265 ++! { dg-do compile } ++! { dg-options "-O3 -w" } ++ ++module pr109265 ++ integer, parameter :: r8 = selected_real_kind (12) ++contains ++ subroutine foo (b, c, d, e, f) ++ implicit none ++ logical :: b ++ real (kind = r8) :: c, d, e, f, i ++ if (b) then ++ c = bar (c * d, e) ++ i = bar (f, c) ++ call baz (i) ++ call baz (-i) ++ end if ++ end subroutine foo ++ function bar (a, b) ++ implicit none ++ real (kind = r8) :: bar ++ real (kind = r8) :: a, b ++ bar = a + b ++ end function bar ++ subroutine baz (b) ++ implicit none ++ real (kind = r8) :: b, d, e, f, g, h, i ++ d = b ++ i = 0 ++ e = d ++ f = d ++ g = d ++ 10 continue ++ if ((e.eq.d) .and. (f.eq.d) .and. (g.eq.d) .and. (h.eq.d)) then ++ h = i ++ goto 10 ++ end if ++ end subroutine baz ++end module pr109265 +--- a/gcc/value-relation.h ++++ b/gcc/value-relation.h +@@ -445,13 +445,6 @@ value_relation::set_relation (relation_kind r, tree n1, tree n2) + { + gcc_checking_assert (TREE_CODE (n1) == SSA_NAME + && TREE_CODE (n2) == SSA_NAME); +- if (n1 == n2 && r != VREL_EQ) +- { +- related = VREL_VARYING; +- name1 = NULL_TREE; +- name2 = NULL_TREE; +- return; +- } + related = r; + name1 = n1; + name2 = n2; +-- +2.31.1 diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230326-r1.ebuild b/sys-devel/gcc/gcc-13.0.1_pre20230326-r1.ebuild new file mode 100644 index 000000000000..f3595ae7bc43 --- /dev/null +++ b/sys-devel/gcc/gcc-13.0.1_pre20230326-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}-76_all_all_PR109265_PR109274_PR109325_range_def_chain.patch + eapply_user +} |