public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2019-05-01 17:14 Sergei Trofimovich
  0 siblings, 0 replies; 11+ messages in thread
From: Sergei Trofimovich @ 2019-05-01 17:14 UTC (permalink / raw
  To: gentoo-commits

commit:     2886ab1e3c924cd8b82354ab1e7011f0a1e3f40d
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed May  1 17:13:42 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed May  1 17:14:10 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2886ab1e

sys-devel/gcc: fix ia64 bootstrap

On ia64 stage2/3 comparison fails due to label wibble.

Bug: https://gcc.gnu.org/87338
Package-Manager: Portage-2.3.66, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-devel/gcc/files/gcc-8.3.0-ia64-bootstrap.patch | 41 ++++++++++++++++++++++
 sys-devel/gcc/gcc-8.2.0-r6.ebuild                  |  5 +++
 sys-devel/gcc/gcc-8.3.0-r1.ebuild                  |  5 +++
 3 files changed, 51 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-8.3.0-ia64-bootstrap.patch b/sys-devel/gcc/files/gcc-8.3.0-ia64-bootstrap.patch
new file mode 100644
index 00000000000..0a0a25b5655
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-8.3.0-ia64-bootstrap.patch
@@ -0,0 +1,41 @@
+https://gcc.gnu.org/PR87338
+
+From 1cc1dc32fcf6b47db4e6d28f55de343713f824a4 Mon Sep 17 00:00:00 2001
+From: James Clarke <jrtc27@jrtc27.com>
+Date: Thu, 25 Apr 2019 15:58:55 +0200
+Subject: [PATCH] PR bootstrap/87338: Fix ia64 bootstrap comparison regression
+ in r257511
+To: gcc-patches@gcc.gnu.org
+
+By using ASM_OUTPUT_LABEL, r257511 forced the assembler to start a new
+bundle when emitting an inline entry label on. Instead, use
+ASM_OUTPUT_DEBUG_LABEL like for the block begin and end labels so tags are
+emitted rather than labels.
+
+gcc/
+	PR bootstrap/87338
+	* dwarf2out.c (dwarf2out_inline_entry): Use ASM_OUTPUT_DEBUG_LABEL
+	instead of ASM_GENERATE_INTERNAL_LABEL and ASM_OUTPUT_LABEL.
+---
+ gcc/dwarf2out.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+--- a/gcc/dwarf2out.c
++++ b/gcc/dwarf2out.c
+@@ -27670,11 +27670,8 @@ dwarf2out_inline_entry (tree block)
+   if (cur_line_info_table)
+     ied->view = cur_line_info_table->view;
+ 
+-  char label[MAX_ARTIFICIAL_LABEL_BYTES];
+-
+-  ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_INLINE_ENTRY_LABEL,
+-			       BLOCK_NUMBER (block));
+-  ASM_OUTPUT_LABEL (asm_out_file, label);
++  ASM_OUTPUT_DEBUG_LABEL (asm_out_file, BLOCK_INLINE_ENTRY_LABEL,
++			  BLOCK_NUMBER (block));
+ }
+ 
+ /* Called from finalize_size_functions for size functions so that their body
+-- 
+1.8.5.3
+

diff --git a/sys-devel/gcc/gcc-8.2.0-r6.ebuild b/sys-devel/gcc/gcc-8.2.0-r6.ebuild
index be3cfb4e292..08707ae05af 100644
--- a/sys-devel/gcc/gcc-8.2.0-r6.ebuild
+++ b/sys-devel/gcc/gcc-8.2.0-r6.ebuild
@@ -18,3 +18,8 @@ DEPEND="${RDEPEND}
 if [[ ${CATEGORY} != cross-* ]] ; then
 	PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.13 )"
 fi
+
+src_prepare() {
+	toolchain_src_prepare
+	epatch "${FILESDIR}"/gcc-8.3.0-ia64-bootstrap.patch
+}

diff --git a/sys-devel/gcc/gcc-8.3.0-r1.ebuild b/sys-devel/gcc/gcc-8.3.0-r1.ebuild
index aa06c78b543..4ccee806e93 100644
--- a/sys-devel/gcc/gcc-8.3.0-r1.ebuild
+++ b/sys-devel/gcc/gcc-8.3.0-r1.ebuild
@@ -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}"/gcc-8.3.0-ia64-bootstrap.patch
+}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2019-05-29 19:22 Andreas K. Hüttel
  0 siblings, 0 replies; 11+ messages in thread
From: Andreas K. Hüttel @ 2019-05-29 19:22 UTC (permalink / raw
  To: gentoo-commits

commit:     7820020a773084fa68917e28bf9a26b7423ca565
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed May 29 19:22:20 2019 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed May 29 19:22:41 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7820020a

sys-devel/gcc: Add patch disabling riscv 32bit ABIs

For more information see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90419

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

 sys-devel/gcc/files/gcc-9.1.0-norisc32.patch | 53 ++++++++++++++++++++++++++++
 sys-devel/gcc/gcc-9.1.0.ebuild               |  5 +++
 2 files changed, 58 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-9.1.0-norisc32.patch b/sys-devel/gcc/files/gcc-9.1.0-norisc32.patch
new file mode 100644
index 00000000000..ad0128a0a18
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-9.1.0-norisc32.patch
@@ -0,0 +1,53 @@
+Autogenerated patch disabling the 32bit RISCV support
+See https://gcc.gnu.org/PR90419
+
+diff -ruN gcc-9.1.0.orig/gcc/config/riscv/t-linux-multilib gcc-9.1.0/gcc/config/riscv/t-linux-multilib
+--- gcc-9.1.0.orig/gcc/config/riscv/t-linux-multilib	2017-02-06 22:38:37.000000000 +0100
++++ gcc-9.1.0/gcc/config/riscv/t-linux-multilib	2019-05-18 23:04:54.849400774 +0200
+@@ -1,40 +1,18 @@
+ # This file was generated by multilib-generator with the command:
+-#  ./multilib-generator rv32imac-ilp32-rv32ima,rv32imaf,rv32imafd,rv32imafc,rv32imafdc- rv32imafdc-ilp32d-rv32imafd- rv64imac-lp64-rv64ima,rv64imaf,rv64imafd,rv64imafc,rv64imafdc- rv64imafdc-lp64d-rv64imafd-
+-MULTILIB_OPTIONS = march=rv32imac/march=rv32ima/march=rv32imaf/march=rv32imafd/march=rv32imafc/march=rv32imafdc/march=rv32g/march=rv32gc/march=rv64imac/march=rv64ima/march=rv64imaf/march=rv64imafd/march=rv64imafc/march=rv64imafdc/march=rv64g/march=rv64gc mabi=ilp32/mabi=ilp32d/mabi=lp64/mabi=lp64d
+-MULTILIB_DIRNAMES = rv32imac \
+-rv32ima \
+-rv32imaf \
+-rv32imafd \
+-rv32imafc \
+-rv32imafdc \
+-rv32g \
+-rv32gc \
+-rv64imac \
++#  ./multilib-generator rv64imac-lp64-rv64ima,rv64imaf,rv64imafd,rv64imafc,rv64imafdc- rv64imafdc-lp64d-rv64imafd-
++MULTILIB_OPTIONS = march=rv64imac/march=rv64ima/march=rv64imaf/march=rv64imafd/march=rv64imafc/march=rv64imafdc/march=rv64g/march=rv64gc mabi=lp64/mabi=lp64d
++MULTILIB_DIRNAMES = rv64imac \
+ rv64ima \
+ rv64imaf \
+ rv64imafd \
+ rv64imafc \
+ rv64imafdc \
+ rv64g \
+-rv64gc ilp32 \
+-ilp32d \
+-lp64 \
++rv64gc 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-9.1.0.ebuild b/sys-devel/gcc/gcc-9.1.0.ebuild
index fd3f2fb8c72..3653171093c 100644
--- a/sys-devel/gcc/gcc-9.1.0.ebuild
+++ b/sys-devel/gcc/gcc-9.1.0.ebuild
@@ -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}"/gcc-9.1.0-norisc32.patch
+}


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

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

commit:     8a2f4e420da5afb22c05c56434a4d6a59050d7c4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 22 01:26:20 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 22 01:27:39 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a2f4e42

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

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

 sys-devel/gcc/Manifest                          |  1 +
 sys-devel/gcc/files/gcc-10.4.0-glibc-2.36.patch | 39 -------------------------
 sys-devel/gcc/gcc-10.4.0.ebuild                 |  6 ++--
 3 files changed, 3 insertions(+), 43 deletions(-)

diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index db2cddc22cbd..bdd835f3bd3a 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -8,6 +8,7 @@ DIST gcc-10.3.0.tar.xz 76692288 BLAKE2B ac7898f5eb8a7c5f151a526d1bb38913a68b50a6
 DIST gcc-10.4.0-musl-patches-1.tar.xz 3808 BLAKE2B 804d1fcc451dcd03be71240dd498ec2d179869571d44012967c48dccf5a478dd8c55000a964a80fdd5584d739a777dee1c83241cffce514ef002df2572854a67 SHA512 83e4a9c0f7062baf0c606a2bcc56a818494991403d7577dea65f04bbc25bdb786a5889b80d45d80e7f4be07c1aef786802cbfcfafd1a17ec255a2d4e93a77570
 DIST gcc-10.4.0-patches-0.tar.bz2 15231 BLAKE2B f64a2e7f317acf9416da69c129ea869116be2780828f9d3cda59f7ea8d39634df7f0347f745275bb167f95aae2a3b8e97ec7c78f775d9002718dd67cb9429f68 SHA512 d1497930ccf4d6ee8700faeb676945e65b3aa2ba3a580a3564575fad1590ad076741f2ecad778ab48d0c4e8ed7723b84b0a660cb67cc4530495691702159a43a
 DIST gcc-10.4.0-patches-2.tar.xz 15000 BLAKE2B 59a61f7de4b6d2338a8b4fbc88a8e55838d5fdce1bd906b798540839a7efca9b97024779b515df6a7673ee6908540834bc1f58188ed9ef311c51e1f351ed003e SHA512 e1c8f0bf9d64db3f84a6eab0f41ee848643a67ba6ab57df7a8267139928f6e292d95c5b4ed865ff8d9a80028bb07cec714d56438b97004cd2a27f111f1f336da
+DIST gcc-10.4.0-patches-3.tar.xz 15820 BLAKE2B e9deca8304a770e5e7bfea504c386325fe0c5663bdae105abdce37ad63138b8a3425a6900594a1c0cc628b70d9166275df01632fad8d33673ddc77d726c87fb7 SHA512 ec83b464c45cb568a8eb7f95a0964382ab0470d8f996a24a6985c7771bb93cbcef29f1619095fa0e1af85e54c7392465e159964775c185a24d97a1dea203253e
 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

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
deleted file mode 100644
index e773071188b7..000000000000
--- a/sys-devel/gcc/files/gcc-10.4.0-glibc-2.36.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-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/gcc-10.4.0.ebuild b/sys-devel/gcc/gcc-10.4.0.ebuild
index 311d04b1e636..7c5902bdee1b 100644
--- a/sys-devel/gcc/gcc-10.4.0.ebuild
+++ b/sys-devel/gcc/gcc-10.4.0.ebuild
@@ -3,11 +3,11 @@
 
 EAPI=8
 
-TOOLCHAIN_PATCH_SUFFIX="xz"
 TOOLCHAIN_PATCH_DEV="sam"
+TOOLCHAIN_PATCH_SUFFIX="xz"
 #TOOLCHAIN_GCC_RC=1
 PATCH_GCC_VER="10.4.0"
-PATCH_VER="2"
+PATCH_VER="3"
 MUSL_VER="1"
 MUSL_GCC_VER="10.4.0"
 
@@ -43,8 +43,6 @@ RDEPEND=""
 BDEPEND="${CATEGORY}/binutils"
 
 src_prepare() {
-	eapply "${FILESDIR}"/${P}-glibc-2.36.patch
-
 	local p upstreamed_patches=(
 		# add them here
 	)


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2023-03-29  1:51 Sam James
  0 siblings, 0 replies; 11+ messages in thread
From: Sam James @ 2023-03-29  1:51 UTC (permalink / raw
  To: gentoo-commits

commit:     d48b81be598d22b4c80bea061776cb58518b3f58
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 29 01:50:21 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 29 01:50:27 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d48b81be

sys-devel/gcc: backport opencv ICE fix for 13

I've decided that for now I'll just put these temporary already-on-master
patches in files/ given I'd have to re-cut the patchset repeatedly otherwise
(have to add it, cut a patchset, then delete it from git immediately so 9999
doesn't break, but then I'm in trouble if I want to backport another patch before
the next snapshot).

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

 ...R109265_PR109274_PR109325_range_def_chain.patch | 219 +++++++++++++++++++++
 sys-devel/gcc/gcc-13.0.1_pre20230326-r1.ebuild     |  57 ++++++
 2 files changed, 276 insertions(+)

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
+}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2023-10-03 19:03 Sam James
  0 siblings, 0 replies; 11+ messages in thread
From: Sam James @ 2023-10-03 19:03 UTC (permalink / raw
  To: gentoo-commits

commit:     ccf0a4e094c6cb18fdb7b4eb3dfb4692d2197ba6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  3 19:02:53 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct  3 19:03:10 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ccf0a4e0

sys-devel/gcc: backport USE=pgo bootstrap fix for 14.0.0_pre20231001

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

 .../gcc-14.0.0_pre20231001-pgo-bootstrap.patch     | 45 ++++++++++++++++++++++
 sys-devel/gcc/gcc-14.0.0_pre20231001.ebuild        |  1 +
 2 files changed, 46 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-14.0.0_pre20231001-pgo-bootstrap.patch b/sys-devel/gcc/files/gcc-14.0.0_pre20231001-pgo-bootstrap.patch
new file mode 100644
index 000000000000..31ad7d855268
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-14.0.0_pre20231001-pgo-bootstrap.patch
@@ -0,0 +1,45 @@
+https://bugs.gentoo.org/914998
+https://gcc.gnu.org/PR111642
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e465e5e4a969334f64cf0d6611de5273d73ea732
+
+From e465e5e4a969334f64cf0d6611de5273d73ea732 Mon Sep 17 00:00:00 2001
+From: Richard Sandiford <richard.sandiford@arm.com>
+Date: Mon, 2 Oct 2023 07:20:45 +0100
+Subject: [PATCH] Fix profiledbootstrap poly_int fallout [PR111642]
+
+rtl-tests.cc and simplify-rtx.cc used partial specialisation
+to try to restrict the NUM_POLY_INT_COEFFS>1 tests without
+resorting to preprocessor tests.  That now triggers an error
+in some configurations, since the NUM_POLY_INT_COEFFS>1 tests
+used the global poly_int64, whose definition does not depend
+on the template parameter.
+
+This patch uses local types that do depend on the template parameter.
+
+gcc/
+	PR bootstrap/111642
+	* rtl-tests.cc (const_poly_int_tests<N>::run): Use a local
+	poly_int64 typedef.
+	* simplify-rtx.cc (simplify_const_poly_int_tests<N>::run): Likewise.
+--- a/gcc/rtl-tests.cc
++++ b/gcc/rtl-tests.cc
+@@ -246,6 +246,7 @@ template<unsigned int N>
+ void
+ const_poly_int_tests<N>::run ()
+ {
++  using poly_int64 = poly_int<N, HOST_WIDE_INT>;
+   rtx x1 = gen_int_mode (poly_int64 (1, 1), QImode);
+   rtx x255 = gen_int_mode (poly_int64 (1, 255), QImode);
+ 
+--- a/gcc/simplify-rtx.cc
++++ b/gcc/simplify-rtx.cc
+@@ -8689,6 +8689,7 @@ template<unsigned int N>
+ void
+ simplify_const_poly_int_tests<N>::run ()
+ {
++  using poly_int64 = poly_int<N, HOST_WIDE_INT>;
+   rtx x1 = gen_int_mode (poly_int64 (1, 1), QImode);
+   rtx x2 = gen_int_mode (poly_int64 (-80, 127), QImode);
+   rtx x3 = gen_int_mode (poly_int64 (-79, -128), QImode);
+-- 
+2.39.3

diff --git a/sys-devel/gcc/gcc-14.0.0_pre20231001.ebuild b/sys-devel/gcc/gcc-14.0.0_pre20231001.ebuild
index 02c5c891469e..b7a4582ecb18 100644
--- a/sys-devel/gcc/gcc-14.0.0_pre20231001.ebuild
+++ b/sys-devel/gcc/gcc-14.0.0_pre20231001.ebuild
@@ -61,4 +61,5 @@ src_prepare() {
 	toolchain_src_prepare
 
 	eapply_user
+	eapply "${FILESDIR}"/${P}-pgo-bootstrap.patch
 }


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2023-10-24  1:59 Sam James
  0 siblings, 0 replies; 11+ messages in thread
From: Sam James @ 2023-10-24  1:59 UTC (permalink / raw
  To: gentoo-commits

commit:     2a19a95aaa27610e6aa81713d31912578dc9ff5a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 24 01:58:45 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 24 01:58:45 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a19a95a

sys-devel/gcc: backport vectorisation ICE fix for gcc 14

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

 .../files/gcc-14.0.0_pre20231022-PR111860.patch    | 129 +++++++++++++++++++++
 sys-devel/gcc/gcc-14.0.0_pre20231022-r1.ebuild     |  65 +++++++++++
 2 files changed, 194 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-14.0.0_pre20231022-PR111860.patch b/sys-devel/gcc/files/gcc-14.0.0_pre20231022-PR111860.patch
new file mode 100644
index 000000000000..42deb046d0f3
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-14.0.0_pre20231022-PR111860.patch
@@ -0,0 +1,129 @@
+https://gcc.gnu.org/PR111860
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=9ed6b22eb4188c57bb3f5cdba5a7effa95395186
+
+From 9ed6b22eb4188c57bb3f5cdba5a7effa95395186 Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Mon, 23 Oct 2023 14:07:20 +0100
+Subject: [PATCH] middle-end: don't keep .MEM guard nodes for PHI nodes who
+ dominate loop [PR111860]
+
+The previous patch tried to remove PHI nodes that dominated the first loop,
+however the correct fix is to only remove .MEM nodes.
+
+This patch thus makes the condition a bit stricter and only tries to remove
+MEM phi nodes.
+
+I couldn't figure out a way to easily determine if a particular PHI is vUSE
+related, so the patch does:
+
+1. check if the definition is a vDEF and not defined in main loop.
+2. check if the definition is a PHI and not defined in main loop.
+3. check if the definition is a default definition.
+
+For no 2 and 3 we may misidentify the PHI, in both cases the value is defined
+outside of the loop version block which also makes it ok to remove.
+
+gcc/ChangeLog:
+
+	PR tree-optimization/111860
+	* tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg):
+	Drop .MEM nodes only.
+
+gcc/testsuite/ChangeLog:
+
+	PR tree-optimization/111860
+	* gcc.dg/vect/pr111860-2.c: New test.
+	* gcc.dg/vect/pr111860-3.c: New test.
+---
+ gcc/testsuite/gcc.dg/vect/pr111860-2.c | 17 +++++++++++++++++
+ gcc/testsuite/gcc.dg/vect/pr111860-3.c | 17 +++++++++++++++++
+ gcc/tree-vect-loop-manip.cc            | 21 ++++++++++++++++++++-
+ 3 files changed, 54 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/gcc.dg/vect/pr111860-2.c
+ create mode 100644 gcc/testsuite/gcc.dg/vect/pr111860-3.c
+
+diff --git a/gcc/testsuite/gcc.dg/vect/pr111860-2.c b/gcc/testsuite/gcc.dg/vect/pr111860-2.c
+new file mode 100644
+index 000000000000..07f64ffb5318
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/vect/pr111860-2.c
+@@ -0,0 +1,17 @@
++/* { dg-do compile } */
++/* { dg-options "-O -fno-tree-sink -ftree-vectorize" } */
++int buffer_ctrl_ctx_0, buffer_ctrl_p1, buffer_ctrl_cmd;
++
++int
++buffer_ctrl (long ret, int i)
++{
++  switch (buffer_ctrl_cmd)
++    {
++    case 1:
++      buffer_ctrl_ctx_0 = 0;
++      for (; i; i++)
++	if (buffer_ctrl_p1)
++	  ret++;
++    }
++  return ret;
++}
+diff --git a/gcc/testsuite/gcc.dg/vect/pr111860-3.c b/gcc/testsuite/gcc.dg/vect/pr111860-3.c
+new file mode 100644
+index 000000000000..07f64ffb5318
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/vect/pr111860-3.c
+@@ -0,0 +1,17 @@
++/* { dg-do compile } */
++/* { dg-options "-O -fno-tree-sink -ftree-vectorize" } */
++int buffer_ctrl_ctx_0, buffer_ctrl_p1, buffer_ctrl_cmd;
++
++int
++buffer_ctrl (long ret, int i)
++{
++  switch (buffer_ctrl_cmd)
++    {
++    case 1:
++      buffer_ctrl_ctx_0 = 0;
++      for (; i; i++)
++	if (buffer_ctrl_p1)
++	  ret++;
++    }
++  return ret;
++}
+diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
+index d67c94700144..43ca985c53ce 100644
+--- a/gcc/tree-vect-loop-manip.cc
++++ b/gcc/tree-vect-loop-manip.cc
+@@ -1626,12 +1626,31 @@ slpeel_tree_duplicate_loop_to_edge_cfg (class loop *loop, edge loop_exit,
+ 	  edge temp_e = redirect_edge_and_branch (exit, new_preheader);
+ 	  flush_pending_stmts (temp_e);
+ 	}
+-
+       /* Record the new SSA names in the cache so that we can skip materializing
+ 	 them again when we fill in the rest of the LCSSA variables.  */
+       for (auto phi : new_phis)
+ 	{
+ 	  tree new_arg = gimple_phi_arg (phi, 0)->def;
++
++	  if (!SSA_VAR_P (new_arg))
++	    continue;
++	  /* If the PHI MEM node dominates the loop then we shouldn't create
++	      a new LC-SSSA PHI for it in the intermediate block.   */
++	  /* A MEM phi that consitutes a new DEF for the vUSE chain can either
++	     be a .VDEF or a PHI that operates on MEM. And said definition
++	     must not be inside the main loop.  Or we must be a parameter.
++	     In the last two cases we may remove a non-MEM PHI node, but since
++	     they dominate both loops the removal is unlikely to cause trouble
++	     as the exits must already be using them.  */
++	  if (virtual_operand_p (new_arg)
++	      && (SSA_NAME_IS_DEFAULT_DEF (new_arg)
++		  || !flow_bb_inside_loop_p (loop,
++				gimple_bb (SSA_NAME_DEF_STMT (new_arg)))))
++	    {
++	      auto gsi = gsi_for_stmt (phi);
++	      remove_phi_node (&gsi, true);
++	      continue;
++	    }
+ 	  new_phi_args.put (new_arg, gimple_phi_result (phi));
+ 
+ 	  if (TREE_CODE (new_arg) != SSA_NAME)
+-- 
+2.39.3

diff --git a/sys-devel/gcc/gcc-14.0.0_pre20231022-r1.ebuild b/sys-devel/gcc/gcc-14.0.0_pre20231022-r1.ebuild
new file mode 100644
index 000000000000..568120f07c07
--- /dev/null
+++ b/sys-devel/gcc/gcc-14.0.0_pre20231022-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="6"
+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}-PR111860.patch
+	eapply_user
+}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2024-03-04 23:34 Sam James
  0 siblings, 0 replies; 11+ messages in thread
From: Sam James @ 2024-03-04 23:34 UTC (permalink / raw
  To: gentoo-commits

commit:     c18d0e4be5597665342d4b16f228cfe4dff9f5b0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  4 23:33:51 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar  4 23:34:12 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c18d0e4b

sys-devel/gcc: backport uninit var fix to 14.0.1_pre20240303

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

 .../gcc/files/gcc-14.0.1_pre20240303-uninit.patch  | 48 ++++++++++++++++++++++
 ...303.ebuild => gcc-14.0.1_pre20240303-r1.ebuild} |  1 +
 2 files changed, 49 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-14.0.1_pre20240303-uninit.patch b/sys-devel/gcc/files/gcc-14.0.1_pre20240303-uninit.patch
new file mode 100644
index 000000000000..5ad41c4581a9
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-14.0.1_pre20240303-uninit.patch
@@ -0,0 +1,48 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=901e7bdab70e2275723ac31dacbbce0b6f68f4f4
+
+From 901e7bdab70e2275723ac31dacbbce0b6f68f4f4 Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Mon, 4 Mar 2024 19:23:02 +0100
+Subject: [PATCH] combine: Fix recent WORD_REGISTER_OPERATIONS check [PR113010]
+
+On Mon, Mar 04, 2024 at 05:18:39PM +0100, Rainer Orth wrote:
+> unfortunately, the patch broke Solaris/SPARC bootstrap
+> (sparc-sun-solaris2.11):
+>
+> .../gcc/combine.cc: In function 'rtx_code simplify_comparison(rtx_code, rtx_def**, rtx_def**)':
+> .../gcc/combine.cc:12101:25: error: '*(unsigned int*)((char*)&inner_mode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))' may be used uninitialized [-Werror=maybe-uninitialized]
+> 12101 |   scalar_int_mode mode, inner_mode, tmode;
+>       |                         ^~~~~~~~~~
+
+I don't see how it could ever work properly, inner_mode in that spot is
+just uninitialized.
+
+I think we shouldn't worry about paradoxical subregs of non-scalar_int_mode
+REGs/MEMs and for the scalar_int_mode ones should initialize inner_mode
+before we use it.
+Another option would be to use
+maybe_lt (GET_MODE_PRECISION (GET_MODE (SUBREG_REG (op0))), BITS_PER_WORD)
+and
+load_extend_op (GET_MODE (SUBREG_REG (op0))) == ZERO_EXTEND,
+or set machine_mode smode = GET_MODE (SUBREG_REG (op0)); and use it in
+those two spots.
+
+2024-03-04  Jakub Jelinek  <jakub@redhat.com>
+
+	PR rtl-optimization/113010
+	* combine.cc (simplify_comparison): Guard the
+	WORD_REGISTER_OPERATIONS check on scalar_int_mode of SUBREG_REG
+	and initialize inner_mode.
+--- a/gcc/combine.cc
++++ b/gcc/combine.cc
+@@ -12554,6 +12554,8 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
+ 	  if (paradoxical_subreg_p (op0))
+ 	    {
+ 	      if (WORD_REGISTER_OPERATIONS
++		  && is_a <scalar_int_mode> (GET_MODE (SUBREG_REG (op0)),
++					     &inner_mode)
+ 		  && GET_MODE_PRECISION (inner_mode) < BITS_PER_WORD
+ 		  /* On WORD_REGISTER_OPERATIONS targets the bits
+ 		     beyond sub_mode aren't considered undefined,
+-- 
+2.39.3

diff --git a/sys-devel/gcc/gcc-14.0.1_pre20240303.ebuild b/sys-devel/gcc/gcc-14.0.1_pre20240303-r1.ebuild
similarity index 97%
rename from sys-devel/gcc/gcc-14.0.1_pre20240303.ebuild
rename to sys-devel/gcc/gcc-14.0.1_pre20240303-r1.ebuild
index 97b3b7629c95..ddfe33a42323 100644
--- a/sys-devel/gcc/gcc-14.0.1_pre20240303.ebuild
+++ b/sys-devel/gcc/gcc-14.0.1_pre20240303-r1.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
 	toolchain_src_prepare
 
+	eapply "${FILESDIR}"/${P}-uninit.patch
 	eapply_user
 }


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2024-03-26 20:09 Sam James
  0 siblings, 0 replies; 11+ messages in thread
From: Sam James @ 2024-03-26 20:09 UTC (permalink / raw
  To: gentoo-commits

commit:     59d1f202c03db9597af4a795560b8f6215a65b4b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 26 20:08:39 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Mar 26 20:08:39 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59d1f202

sys-devel/gcc: backport fix for building e.g. dev-libs/icu

Closes: https://bugs.gentoo.org/927657
Closes: https://bugs.gentoo.org/927814
Closes: https://bugs.gentoo.org/927815
Closes: https://bugs.gentoo.org/927853
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/gcc-14.0.1_pre20240324-PR114439.patch    | 112 +++++++++++++++++++++
 ...324.ebuild => gcc-14.0.1_pre20240324-r1.ebuild} |   1 +
 2 files changed, 113 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-14.0.1_pre20240324-PR114439.patch b/sys-devel/gcc/files/gcc-14.0.1_pre20240324-PR114439.patch
new file mode 100644
index 000000000000..2f92ab10cebf
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-14.0.1_pre20240324-PR114439.patch
@@ -0,0 +1,112 @@
+https://bugs.gentoo.org/927657
+https://gcc.gnu.org/PR114439
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=de0886d48032332d10e4acb5d15c8789b281b6fe
+
+From de0886d48032332d10e4acb5d15c8789b281b6fe Mon Sep 17 00:00:00 2001
+From: Marek Polacek <polacek@redhat.com>
+Date: Mon, 25 Mar 2024 15:32:20 -0400
+Subject: [PATCH] c++: broken direct-init with trailing array member [PR114439]
+
+can_init_array_with_p is wrongly saying that the init for 's' here:
+
+  struct S {
+    int *list = arr;
+    int arr[];
+  };
+
+  struct A {
+    A() {}
+    S s[2]{};
+  };
+
+is invalid.  But as process_init_constructor_array says, for "non-constant
+initialization of trailing elements with no explicit initializers" we use
+a VEC_INIT_EXPR wrapped in a TARGET_EXPR, built in process_init_constructor.
+
+Unfortunately we didn't have a test for this scenario so I didn't
+realize can_init_array_with_p must handle it.
+
+	PR c++/114439
+
+gcc/cp/ChangeLog:
+
+	* init.cc (can_init_array_with_p): Return true for a VEC_INIT_EXPR
+	wrapped in a TARGET_EXPR.
+
+gcc/testsuite/ChangeLog:
+
+	* g++.dg/init/array65.C: New test.
+---
+ gcc/cp/init.cc                      |  6 ++++-
+ gcc/testsuite/g++.dg/init/array65.C | 38 +++++++++++++++++++++++++++++
+ 2 files changed, 43 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/g++.dg/init/array65.C
+
+diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
+index dbd37d47cbf..a93ce00800c 100644
+--- a/gcc/cp/init.cc
++++ b/gcc/cp/init.cc
+@@ -950,12 +950,16 @@ can_init_array_with_p (tree type, tree init)
+      mem-initializers of a constructor.  */
+   if (DECL_DEFAULTED_FN (current_function_decl))
+     return true;
+-  /* As an extension, we allow copying from a compound literal.  */
+   if (TREE_CODE (init) == TARGET_EXPR)
+     {
+       init = TARGET_EXPR_INITIAL (init);
++      /* As an extension, we allow copying from a compound literal.  */
+       if (TREE_CODE (init) == CONSTRUCTOR)
+ 	return CONSTRUCTOR_C99_COMPOUND_LITERAL (init);
++      /* VEC_INIT_EXPR is used for non-constant initialization of trailing
++	 elements with no explicit initializers.  */
++      else if (TREE_CODE (init) == VEC_INIT_EXPR)
++	return true;
+     }
+ 
+   return false;
+diff --git a/gcc/testsuite/g++.dg/init/array65.C b/gcc/testsuite/g++.dg/init/array65.C
+new file mode 100644
+index 00000000000..0b144f45a9d
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/init/array65.C
+@@ -0,0 +1,38 @@
++// PR c++/114439
++// { dg-do compile { target c++11 } }
++
++struct S {
++  int *list = arr;
++  __extension__ int arr[];
++};
++
++struct R {
++  int *list = arr;
++  int arr[2];
++};
++
++struct A {
++  A() {}
++  S s[2]{};
++};
++
++struct A2 {
++  A2() {}
++  S s[2]{ {}, {} };
++};
++
++struct B {
++  B() {}
++  R r[2]{};
++};
++
++struct B2 {
++  B2() {}
++  R r[2]{ {}, {} };
++};
++
++struct S1 { S1(); };
++struct S2 {
++  S2() {}
++  S1 a[1] {};
++};
+-- 
+2.39.3

diff --git a/sys-devel/gcc/gcc-14.0.1_pre20240324.ebuild b/sys-devel/gcc/gcc-14.0.1_pre20240324-r1.ebuild
similarity index 97%
rename from sys-devel/gcc/gcc-14.0.1_pre20240324.ebuild
rename to sys-devel/gcc/gcc-14.0.1_pre20240324-r1.ebuild
index e809e40f6564..41416832f8b5 100644
--- a/sys-devel/gcc/gcc-14.0.1_pre20240324.ebuild
+++ b/sys-devel/gcc/gcc-14.0.1_pre20240324-r1.ebuild
@@ -62,5 +62,6 @@ src_prepare() {
 	toolchain_src_prepare
 
 	eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
+	eapply "${FILESDIR}"/${P}-PR114439.patch
 	eapply_user
 }


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2024-05-08 14:56 Sam James
  0 siblings, 0 replies; 11+ messages in thread
From: Sam James @ 2024-05-08 14:56 UTC (permalink / raw
  To: gentoo-commits

commit:     85471c97929d3dfb52f80c556f1803d099dfc01c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed May  8 14:55:04 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May  8 14:55:04 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85471c97

sys-devel/gcc: backport fix for Emacs tests to 14.1.0

This _just_ missed the 14.1 release as it got reported a few hours before
the tag was made. Part of Emacs is miscompiled without this and it causes
test failures, so let's pull in the fix now.

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

 .../gcc/files/gcc-14.1.0-emacs-PR114965.patch      | 106 +++++++++++++++++++++
 sys-devel/gcc/gcc-14.1.0-r1.ebuild                 |  54 +++++++++++
 2 files changed, 160 insertions(+)

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
+}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2024-09-23 15:23 Sam James
  0 siblings, 0 replies; 11+ messages in thread
From: Sam James @ 2024-09-23 15:23 UTC (permalink / raw
  To: gentoo-commits

commit:     d2d84f5c5270a36f190fdb9925809ace48a3f88c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 23 15:21:36 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep 23 15:22:48 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2d84f5c

sys-devel/gcc: add 15.0.0_pre20240922-r1

Has the patch (not yet merged upstream) I mentioned earlier in
24a912568998dbaafab500dee1b478db940fe9a7.

Some weeks it's very quiet, some it's adventurous, but that's the game :)

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

 ...check-explicitly-for-external-or-constant.patch | 93 ++++++++++++++++++++++
 sys-devel/gcc/gcc-15.0.0_pre20240922-r1.ebuild     | 57 +++++++++++++
 2 files changed, 150 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch b/sys-devel/gcc/files/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch
new file mode 100644
index 000000000000..6dcc1a46c96a
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch
@@ -0,0 +1,93 @@
+https://inbox.sourceware.org/gcc-patches/patch-18806-tamar@arm.com/T/#u
+https://gcc.gnu.org/PR116817
+
+From 9a5d1eb943dcaf26551b534eb62cbf1dd8443335 Mon Sep 17 00:00:00 2001
+Message-ID: <9a5d1eb943dcaf26551b534eb62cbf1dd8443335.1727104663.git.sam@gentoo.org>
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Mon, 23 Sep 2024 15:29:52 +0100
+Subject: [PATCH] middle-end: check explicitly for external or constants when
+ checking for loop invariant [PR116817]
+
+Hi All,
+
+The previous check if a value was external was checking
+!vect_get_internal_def (vinfo, var) but this of course isn't completely right
+as they could reductions etc.
+
+This changes the check to just explicitly look at externals and constants.
+Note that reductions remain unhandled here, but we don't support codegen of
+boolean reductions today anyway.
+
+So at the time we do then this would have the be handled as well in lowering.
+
+Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
+
+Ok for master?
+
+Thanks,
+Tamar
+
+gcc/ChangeLog:
+
+	PR tree-optimization/116817
+	* tree-vect-patterns.cc (vect_recog_bool_pattern): Check for const or
+	externals.
+
+gcc/testsuite/ChangeLog:
+
+PR tree-optimization/116817
+	* g++.dg/vect/pr116817.cc: New test.
+---
+ gcc/testsuite/g++.dg/vect/pr116817.cc | 16 ++++++++++++++++
+ gcc/tree-vect-patterns.cc             |  5 ++++-
+ 2 files changed, 20 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/g++.dg/vect/pr116817.cc
+
+diff --git a/gcc/testsuite/g++.dg/vect/pr116817.cc b/gcc/testsuite/g++.dg/vect/pr116817.cc
+new file mode 100644
+index 00000000000..7e28982fb13
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/vect/pr116817.cc
+@@ -0,0 +1,16 @@
++/* { dg-do compile } */
++/* { dg-additional-options "-O3" } */
++
++int main_ulData0;
++unsigned *main_pSrcBuffer;
++int main(void) {
++  int iSrc = 0;
++  bool bData0;
++  for (; iSrc < 4; iSrc++) {
++    if (bData0)
++      main_pSrcBuffer[iSrc] = main_ulData0;
++    else
++      main_pSrcBuffer[iSrc] = 0;
++    bData0 = !bData0;
++  }
++}
+diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
+index e7e877dd2ad..b913d6de003 100644
+--- a/gcc/tree-vect-patterns.cc
++++ b/gcc/tree-vect-patterns.cc
+@@ -6062,12 +6062,15 @@ vect_recog_bool_pattern (vec_info *vinfo,
+       if (get_vectype_for_scalar_type (vinfo, type) == NULL_TREE)
+ 	return NULL;
+ 
++      stmt_vec_info var_def_info = vinfo->lookup_def (var);
+       if (check_bool_pattern (var, vinfo, bool_stmts))
+ 	var = adjust_bool_stmts (vinfo, bool_stmts, type, stmt_vinfo);
+       else if (integer_type_for_mask (var, vinfo))
+ 	return NULL;
+       else if (TREE_CODE (TREE_TYPE (var)) == BOOLEAN_TYPE
+-	       && !vect_get_internal_def (vinfo, var))
++	       && var_def_info
++	       && (STMT_VINFO_DEF_TYPE (var_def_info) == vect_external_def
++		   || STMT_VINFO_DEF_TYPE (var_def_info) == vect_constant_def))
+ 	{
+ 	  /* If the condition is already a boolean then manually convert it to a
+ 	     mask of the given integer type but don't set a vectype.  */
+
+base-commit: 358db2e3ed4acf44282d1d9ebbc4a1a3b6e38d21
+-- 
+2.46.1
+

diff --git a/sys-devel/gcc/gcc-15.0.0_pre20240922-r1.ebuild b/sys-devel/gcc/gcc-15.0.0_pre20240922-r1.ebuild
new file mode 100644
index 000000000000..de217fae9b75
--- /dev/null
+++ b/sys-devel/gcc/gcc-15.0.0_pre20240922-r1.ebuild
@@ -0,0 +1,57 @@
+# 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="12"
+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
+
+SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/gcc-15-20240922-rollup-patches.tar.xz"
+
+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 "${WORKDIR}"/gcc-15-20240922-rollup-patches
+	eapply "${FILESDIR}"/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch
+	eapply_user
+}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2024-09-24  1:41 Sam James
  0 siblings, 0 replies; 11+ messages in thread
From: Sam James @ 2024-09-24  1:41 UTC (permalink / raw
  To: gentoo-commits

commit:     d59511d0897069de50e27767c07952893624bdc9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 24 01:40:01 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 24 01:40:22 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d59511d0

sys-devel/gcc: update vect patch for 15.0.0_pre20240922

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

 ...middle-end-check-explicitly-for-external-or-constant.patch | 11 +++--------
 ...pre20240922-r1.ebuild => gcc-15.0.0_pre20240922-r2.ebuild} |  0
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/sys-devel/gcc/files/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch b/sys-devel/gcc/files/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch
index 6dcc1a46c96a..7dcf89df5228 100644
--- a/sys-devel/gcc/files/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch
+++ b/sys-devel/gcc/files/gcc-15.0.0_pre20240922-middle-end-check-explicitly-for-external-or-constant.patch
@@ -66,7 +66,7 @@ index 00000000000..7e28982fb13
 +  }
 +}
 diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
-index e7e877dd2ad..b913d6de003 100644
+index e7e877dd2adb55262822f1660f8d92b42d44e6d0..f0298b2ab97a1e7dd0d943340e1389c3c0fa796e 100644
 --- a/gcc/tree-vect-patterns.cc
 +++ b/gcc/tree-vect-patterns.cc
 @@ -6062,12 +6062,15 @@ vect_recog_bool_pattern (vec_info *vinfo,
@@ -80,14 +80,9 @@ index e7e877dd2ad..b913d6de003 100644
  	return NULL;
        else if (TREE_CODE (TREE_TYPE (var)) == BOOLEAN_TYPE
 -	       && !vect_get_internal_def (vinfo, var))
-+	       && var_def_info
-+	       && (STMT_VINFO_DEF_TYPE (var_def_info) == vect_external_def
++	       && (!var_def_info
++		   || STMT_VINFO_DEF_TYPE (var_def_info) == vect_external_def
 +		   || STMT_VINFO_DEF_TYPE (var_def_info) == vect_constant_def))
  	{
  	  /* If the condition is already a boolean then manually convert it to a
  	     mask of the given integer type but don't set a vectype.  */
-
-base-commit: 358db2e3ed4acf44282d1d9ebbc4a1a3b6e38d21
--- 
-2.46.1
-

diff --git a/sys-devel/gcc/gcc-15.0.0_pre20240922-r1.ebuild b/sys-devel/gcc/gcc-15.0.0_pre20240922-r2.ebuild
similarity index 100%
rename from sys-devel/gcc/gcc-15.0.0_pre20240922-r1.ebuild
rename to sys-devel/gcc/gcc-15.0.0_pre20240922-r2.ebuild


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

end of thread, other threads:[~2024-09-24  1:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-03 19:03 [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-09-24  1:41 Sam James
2024-09-23 15:23 Sam James
2024-05-08 14:56 Sam James
2024-03-26 20:09 Sam James
2024-03-04 23:34 Sam James
2023-10-24  1:59 Sam James
2023-03-29  1:51 Sam James
2022-08-22  1:41 Sam James
2019-05-29 19:22 Andreas K. Hüttel
2019-05-01 17:14 Sergei Trofimovich

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