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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2024-12-27 18:01 Sam James
  0 siblings, 0 replies; 13+ messages in thread
From: Sam James @ 2024-12-27 18:01 UTC (permalink / raw
  To: gentoo-commits

commit:     f4370b1ba875aa9776d01bd89268e8e1a77281c8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 27 18:00:42 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 27 18:00:58 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4370b1b

sys-devel/gcc: drop old 15 snapshots

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

 sys-devel/gcc/Manifest                             |  11 -
 ...llow-bool-and-enum-null-pointer-constants.patch | 244 ---------------------
 sys-devel/gcc/gcc-15.0.0_pre20241117-r2.ebuild     |  54 -----
 sys-devel/gcc/gcc-15.0.0_pre20241124.ebuild        |  53 -----
 sys-devel/gcc/gcc-15.0.0_pre20241201.ebuild        |  53 -----
 sys-devel/gcc/gcc-15.0.0_pre20241208-r1.ebuild     |  53 -----
 sys-devel/gcc/gcc-15.0.0_pre20241208.ebuild        |  53 -----
 sys-devel/gcc/gcc-15.0.0_pre20241215.ebuild        |  53 -----
 8 files changed, 574 deletions(-)

diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index 7f82ec48dc6d..7eaa0020d41d 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -25,19 +25,8 @@ DIST gcc-14-20241221.tar.xz 88198252 BLAKE2B 7491c2e1c8885e201859143bdf5cae95af4
 DIST gcc-14.1.0-musl-patches-1.tar.xz 3600 BLAKE2B 4cd920b7ca1f122cae806707564d8e45bfd48e78c88788a12a301f6068b5a5f335d8885e67479ac536c66aeaa81f2ecb7240ae56e9fc821a7246ab66b453711f SHA512 61c48d90a55dfc2129d96aee69d939d6a89f6407f69f7bd12c1a619f28989f471fd219d731958f8e62b0fd650c32300f0ad8dc06d5df23d9fc8c1a77fe210c25
 DIST gcc-14.2.0-patches-3.tar.xz 13920 BLAKE2B 5b3efa54671581d97ae664e73629f247c776d84eea0b10f8d3223502582f1d1086fff86a6cde6c35b6b43d134af4dad3135d3de5531cfccb320a7fc884ab39ef SHA512 d47549e902055414142f650c7098f029410549741542553b1d0c0519f046a958561f92552e44f59663a7645d42316af5dab1462f54f50f2205257be6744c2fce
 DIST gcc-14.2.0-patches-7.tar.xz 14244 BLAKE2B 11236e91e1fe83fec8ffaa40ec0cdd4b52a00a951e9aa9a7a0a932b234b8f1a9603333a7ccf55859f4ef53dd4d8ad1fd5c1d2514b6e45fce5b86bb58622a0ecc SHA512 5a4d86d943e31fa068b5a784c0132bd83c23243dcb3cf972557a42e004469a415e1b3185f31b1bb36f916594d475f266a2fda031a414e4a15e0bbfe471269eee
-DIST gcc-15-20241117.tar.xz 90065532 BLAKE2B 22ffd82f77871df3c90667d3fbc08ff721586c851aea6e79a34bf065468307c132d62581b7cceaf9b2bc6cc54be8d6ec1dbde241e01454a343e2c48c804a4cea SHA512 70fb8dbdf5a98e3216a5c64c544d9208dd153a71266312e12189ea8ef03abf8b4d29153e0550a556b93e47ef2315e60bf2f5e080db82ffb3c6bb3dc2a3c8aa10
-DIST gcc-15-20241124.tar.xz 90251704 BLAKE2B d9c2a4342ca2229e345e163a8781e7ea8f4682734f5b1f4c9783272e0a362bc4fb0c5b5042363d996ea0473836c53cbf437761389062d076ce5595c1cdb2bcf2 SHA512 36e30e658f45b3b6cd5968cdae15216d6d874349349dce30f7d8c7c7bda1eff841d4d1eb4471956acfab04300c7169872210d26a5d05dd1ae0167d601a2adeed
-DIST gcc-15-20241201.tar.xz 90331368 BLAKE2B 883b9073ff5927acaf7f6e0d06c4ddd8d603b0168aba1609f476fce1a6ecd8b78b894b75c5cb7ebe383a0248afdeeb058f1221db3a4fdd4822df79a1ba29c816 SHA512 6d09f84ce609bfac816ac326f37475d61d9232aa502de9429d036a82b501370842dbb9b8c5b650b0e01f668dfb0e2a14e1f8af2d6f175b79d920f6208d596a8b
-DIST gcc-15-20241208.tar.xz 90369108 BLAKE2B 83953dcb3fd42168fb0bdee6336698dda6758626499bb474da56a1eaf22f422825e743997290b9a3241ae6fc3582ebfa9c9e6e7d56df599be10412556e1af26b SHA512 64f92431c5714d598ecb7819eb30971c9b050dab53cee37401581e7587facc4c7f19312f8fa9be3b0847de55f7818defb82279a81d4c49c7fccbce9877b8846b
-DIST gcc-15-20241215.tar.xz 90419336 BLAKE2B 2d36169400d3d62b101aa7e86298295f8d2eef87475e4785b2d78f2978184d55368c5b2e3e3b29d888593c723c5c1f7c31cf0e386269dca162ffd47bbd67fa6c SHA512 d8cb770ea7770b81074ef3ecf10ac5d879a7e22e9a7935c9432e53f3729dab8c667ac3cae0eb9cb798c9f72313c163a256b5f8bfdd4b6f571d3ff2fa15d24ab6
 DIST gcc-15-20241222.tar.xz 90484776 BLAKE2B 8889a11be56a47a9cff26573e9e6fcaa2d7b92b7a5c4509503cbcd38eb03f23a009879bcbd5de33b8c993a34c25b3c5aafb6c9506ff5335f05a572523a41fc52 SHA512 5f571cb073e4c9d10154d135a4fc50986d956417af69c9735e39d9fd49f5cf460a5847ea095b61511917ed0a69197e9afb338c2c8c5b3e7b68673828a3d0d95f
 DIST gcc-15.0.0-musl-patches-2.tar.xz 3076 BLAKE2B 0073248fe4f7dd827980559017b5aa1fb5c4c46acc9ad5c410dc152fd1e44966d3066bf7152338573cb45b1c36027de5f0c519abd414d97a37bccef07f6a5281 SHA512 295f1a669020bbe2874e9b03afd46b5d083073b276fca3543f3767a2d74f35df81cf0a67abad50c200cf7a3af36ec98ff9977cb7d5c19f334af7d3bb1926a3de
-DIST gcc-15.0.0-patches-26.tar.xz 18864 BLAKE2B dc11d5a4d292ae53558601a59a34a619f6e0bbe223e6645a82a04fcd3b83b5788a3a7fdd14ac6fc2fde079302355dbef1a94c283725807425e1ce8d67e28f416 SHA512 14721dffb4dac9394239a82c52e3cbf47094dadc1b310b55a71101ca7ba1a5077fd137f39fbfb89896d324117f6a13c97dc8e8fa8cedecc5c2af4179de7e7f1f
-DIST gcc-15.0.0-patches-28.tar.xz 19884 BLAKE2B 36e982dd8c98853e84d977c7be9e7b1decf2ac10f61bdd76d3aed3ba415345039539cb00e03c6f6d86573a890431a39539ca04c54489aa7a3c29cb4b48faa2af SHA512 d95ee81beff83d43f2a42d440c032535e31b9121868b9c18e825e0c0185f5c42173634286274c527668897333104e52137c4b1e0305fee5d86ac4c5be9601b94
-DIST gcc-15.0.0-patches-29.tar.xz 28048 BLAKE2B 592227c6ecf581d6670ad09e09a279c018796cd9709b9c45c8d28af5a8f8858b5e9c0739b395e96fe79fedc9a7a60e82011b78581a8acadd3ceaaaa3e9751527 SHA512 4fb9d34feb570ea5e56ebca6588d367840457cf36f7818327317ee417f90593178adcace042106cd639032cf526a4a05cfd86f9e01eade1827eb5a90f03a7cc7
-DIST gcc-15.0.0-patches-30.tar.xz 30564 BLAKE2B 3d99ddcd03bc6f6b71c599cf07873c8ba6baa1db3e763227bb88181f926d128dae98c8290cf165fe484950a7fba71a8fefa8e8230c293ad50cba06b945921ddd SHA512 1d5812775b667a46b88d0d4923dfacef163bf25301f769df0e461ae1e990b6d3cc0686bda40bb9d5adc0570b33aa7e9c537c793ad4a7757939856beb320cd399
-DIST gcc-15.0.0-patches-31.tar.xz 33844 BLAKE2B 90faa70090e4a4ee9f79d7a8ca43b17cf073d2a6d33cff701d3f726517b385ab52097d0513ce73a5b94e4f3d37525074bf19b2d189e75b2bd7cc7c452832a350 SHA512 6837bbef863a9ec95adb65afc076315f7d56b7861c5eff35b47722ed9726ccdb3ab578cc8b6bfbf2b7373fbf74d78cfb06bfe06398bf217be2e079132e44e6d7
-DIST gcc-15.0.0-patches-32.tar.xz 22612 BLAKE2B d41057e3b76c75f2734462e56e5c80a55bfb1619b9e395e4777e3a49f41f7fc45686fe0b54ff6203e1e783b61721827961e0928ee2a8d3b50f7b11d80efb7bad SHA512 3569db8133cc692449705377c42b5d44cd8417cb6e228043f824fe405c9b99b3486d8628f983cd8bead2081d31f8bcda1c63e413cbf646ae6ca49a1ff428dffa
 DIST gcc-15.0.0-patches-34.tar.xz 30468 BLAKE2B cabe6a1831d2c9397838853a9a09482591ff9f4ffbc2304099f535b45eadb1cd61f0bd06ca016333c0e537a4481b52d4fbab4463364b49625f999645b1711846 SHA512 3a737d05991b6349eb585ae2861dba5426d11bb3cc46d33af46e8ecb95c842075eb739c858df22e4aa0fa9e3041d415aecf2141382fe9f14809fec4db48a448f
 DIST gcc-8.5.0-patches-4.tar.xz 18616 BLAKE2B 7594cbaea5daecf1a0b3d526c06aeba0a84c6da66aee2e105a51fda6be8d30a37ccc3814281b284a4582d892a1d556bca063551584edfc2525bed8ea5b6888e7 SHA512 1aa5742c361186637e7855f06feb1a4547e7d4d5de6e51f3d049e0ef3c19e2eff179465f52781739f59422035b7f8e4c0efa3844849f920f3c96acfdc37ca6a6
 DIST gcc-8.5.0.tar.xz 63841008 BLAKE2B aa81a1a730fd7371360f6abed6ba78b5843fd18c58d5de5687acc320741b9e430e85df3535a1ef7a26051409be8d2f0945f503e5968480d919103123a99d4b12 SHA512 92f599680e6b7fbce88bcdda810f468777d541e5fddfbb287f7977d51093de2a5178bd0e6a08dfe37090ea10a0508a43ccd00220041abbbec33f1179bfc174d8

diff --git a/sys-devel/gcc/files/gcc-15.0.0_pre20241117-PR112556-c-Allow-bool-and-enum-null-pointer-constants.patch b/sys-devel/gcc/files/gcc-15.0.0_pre20241117-PR112556-c-Allow-bool-and-enum-null-pointer-constants.patch
deleted file mode 100644
index b17c1e04998c..000000000000
--- a/sys-devel/gcc/files/gcc-15.0.0_pre20241117-PR112556-c-Allow-bool-and-enum-null-pointer-constants.patch
+++ /dev/null
@@ -1,244 +0,0 @@
-From 3d525fce70fa0ffa0b22af6e213643e1ceca5ab5 Mon Sep 17 00:00:00 2001
-Message-ID: <3d525fce70fa0ffa0b22af6e213643e1ceca5ab5.1731987909.git.sam@gentoo.org>
-From: Joseph Myers <josmyers@redhat.com>
-Date: Mon, 18 Nov 2024 22:24:48 +0000
-Subject: [PATCH] c: Allow bool and enum null pointer constants [PR112556]
-
-As reported in bug 112556, GCC wrongly rejects conversion of null
-pointer constants with bool or enum type to pointers in
-convert_for_assignment (assignment, initialization, argument passing,
-return).  Fix the code there to allow BOOLEAN_TYPE and ENUMERAL_TYPE;
-it already allowed INTEGER_TYPE and BITINT_TYPE.
-
-This bug (together with -std=gnu23 meaning false has type bool rather
-than int) has in turn resulted in people thinking they need to fix
-code using false as a null pointer constant for C23 compatibility.
-While such a usage is certainly questionable, it has nothing to do
-with C23 compatibility and the right place for warnings about such
-usage is -Wzero-as-null-pointer-constant.  I think it would be
-appropriate to extend -Wzero-as-null-pointer-constant to cover
-BOOLEAN_TYPE, ENUMERAL_TYPE and BITINT_TYPE (in all the various
-contexts in which that option generates warnings), though this patch
-doesn't do anything about that option.
-
-Bootstrapped with no regressions for x86-64-pc-linux-gnu.
-
-	PR c/112556
-
-gcc/c/
-	* c-typeck.cc (convert_for_assignment): Allow conversion of
-	ENUMERAL_TYPE and BOOLEAN_TYPE null pointer constants to pointers.
-
-gcc/testsuite/
-	* gcc.dg/c11-null-pointer-constant-1.c,
-	gcc.dg/c23-null-pointer-constant-1.c: New tests.
----
- gcc/c/c-typeck.cc                             |   2 +
- .../gcc.dg/c11-null-pointer-constant-1.c      |  55 ++++++++
- .../gcc.dg/c23-null-pointer-constant-1.c      | 120 ++++++++++++++++++
- 3 files changed, 177 insertions(+)
- create mode 100644 gcc/testsuite/gcc.dg/c11-null-pointer-constant-1.c
- create mode 100644 gcc/testsuite/gcc.dg/c23-null-pointer-constant-1.c
-
-diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
-index 26ee0ebf91f0..a701dd090fb8 100644
---- a/gcc/c/c-typeck.cc
-+++ b/gcc/c/c-typeck.cc
-@@ -8457,6 +8457,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
-     }
-   else if (codel == POINTER_TYPE
- 	   && (coder == INTEGER_TYPE
-+	       || coder == ENUMERAL_TYPE
-+	       || coder == BOOLEAN_TYPE
- 	       || coder == NULLPTR_TYPE
- 	       || coder == BITINT_TYPE))
-     {
-diff --git a/gcc/testsuite/gcc.dg/c11-null-pointer-constant-1.c b/gcc/testsuite/gcc.dg/c11-null-pointer-constant-1.c
-new file mode 100644
-index 000000000000..f463a1a59da3
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/c11-null-pointer-constant-1.c
-@@ -0,0 +1,55 @@
-+/* Test zero with different types as null pointer constant: bug 112556.  */
-+/* { dg-do compile } */
-+/* { dg-options "-std=c11 -pedantic-errors -Wno-pointer-compare" } */
-+
-+enum e { ZERO };
-+
-+void *p1 = 0;
-+void *p2 = 0LL;
-+void *p3 = (char) 0;
-+void *p4 = 0UL;
-+void *p5 = (_Bool) 0;
-+void *p6 = (enum e) ZERO;
-+
-+void f (void *);
-+
-+void *
-+g (void)
-+{
-+  p1 = 0;
-+  p2 = 0LL;
-+  p3 = (char) 0;
-+  p4 = 0UL;
-+  p5 = (_Bool) 0;
-+  p6 = (enum e) ZERO;
-+  f (0);
-+  f (0ULL);
-+  f (0L);
-+  f ((char) 0);
-+  f ((_Bool) 0);
-+  f ((enum e) ZERO);
-+  (1 ? p1 : 0);
-+  (1 ? p1 : 0L);
-+  (1 ? p1 : 0ULL);
-+  (1 ? p1 : (char) 0);
-+  (1 ? p1 : (_Bool) 0);
-+  (1 ? p1 : (enum e) 0);
-+  p1 == 0;
-+  p1 == 0LL;
-+  p1 == 0U;
-+  p1 == (char) 0;
-+  p1 == (_Bool) 0;
-+  p1 == (enum e) 0;
-+  p1 != 0;
-+  p1 != 0LL;
-+  p1 != 0U;
-+  p1 != (char) 0;
-+  p1 != (_Bool) 0;
-+  p1 != (enum e) 0;
-+  return 0;
-+  return 0UL;
-+  return 0LL;
-+  return (char) 0;
-+  return (_Bool) 0;
-+  return (enum e) 0;
-+}
-diff --git a/gcc/testsuite/gcc.dg/c23-null-pointer-constant-1.c b/gcc/testsuite/gcc.dg/c23-null-pointer-constant-1.c
-new file mode 100644
-index 000000000000..71b66cc35d6b
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/c23-null-pointer-constant-1.c
-@@ -0,0 +1,120 @@
-+/* Test zero with different types as null pointer constant: bug 112556.  */
-+/* { dg-do compile } */
-+/* { dg-options "-std=c23 -pedantic-errors -Wno-pointer-compare" } */
-+
-+enum e { ZERO };
-+enum e2 : bool { BZERO };
-+enum e3 : long { LZERO };
-+
-+void *p1 = 0;
-+void *p2 = 0LL;
-+void *p3 = (char) 0;
-+void *p4 = 0UL;
-+void *p5 = (bool) 0;
-+void *p6 = (enum e) ZERO;
-+void *p7 = false;
-+void *p8 = BZERO;
-+void *p9 = (enum e2) 0;
-+void *p10 = LZERO;
-+void *p11 = (enum e3) 0;
-+#ifdef __BITINT_MAXWIDTH__
-+void *p12 = 0wb;
-+void *p13 = 0uwb;
-+#endif
-+
-+void f (void *);
-+
-+void *
-+g (void)
-+{
-+  p1 = 0;
-+  p2 = 0LL;
-+  p3 = (char) 0;
-+  p4 = 0UL;
-+  p5 = (bool) 0;
-+  p6 = (enum e) ZERO;
-+  p7 = false;
-+  p8 = BZERO;
-+  p9 = (enum e2) 0;
-+  p10 = LZERO;
-+  p11 = (enum e3) 0;
-+#ifdef __BITINT_MAXWIDTH__
-+  p12 = 0wb;
-+  p13 = 0uwb;
-+#endif
-+  f (0);
-+  f (0ULL);
-+  f (0L);
-+  f ((char) 0);
-+  f ((bool) 0);
-+  f ((enum e) ZERO);
-+  f (false);
-+  f (BZERO);
-+  f ((enum e2) 0);
-+  f (LZERO);
-+  f ((enum e3) 0);
-+#ifdef __BITINT_MAXWIDTH__
-+  f (0wb);
-+  f (0uwb);
-+#endif
-+  (1 ? p1 : 0);
-+  (1 ? p1 : 0L);
-+  (1 ? p1 : 0ULL);
-+  (1 ? p1 : (char) 0);
-+  (1 ? p1 : (bool) 0);
-+  (1 ? p1 : (enum e) 0);
-+  (1 ? p1 : false);
-+  (1 ? p1 : BZERO);
-+  (1 ? p1 : (enum e2) 0);
-+  (1 ? p1 : LZERO);
-+  (1 ? p1 : (enum e3) 0);
-+#ifdef __BITINT_MAXWIDTH__
-+  (1 ? p1 : 0wb);
-+  (1 ? p1 : 0uwb);
-+#endif
-+  p1 == 0;
-+  p1 == 0LL;
-+  p1 == 0U;
-+  p1 == (char) 0;
-+  p1 == (bool) 0;
-+  p1 == (enum e) 0;
-+  p1 == false;
-+  p1 == BZERO;
-+  p1 == (enum e2) 0;
-+  p1 == LZERO;
-+  p1 == (enum e3) 0;
-+#ifdef __BITINT_MAXWIDTH__
-+  p1 == 0wb;
-+  p1 == 0uwb;
-+#endif
-+  p1 != 0;
-+  p1 != 0LL;
-+  p1 != 0U;
-+  p1 != (char) 0;
-+  p1 != (bool) 0;
-+  p1 != (enum e) 0;
-+  p1 != false;
-+  p1 != BZERO;
-+  p1 != (enum e2) 0;
-+  p1 != LZERO;
-+  p1 != (enum e3) 0;
-+#ifdef __BITINT_MAXWIDTH__
-+  p1 != 0wb;
-+  p1 != 0uwb;
-+#endif
-+  return 0;
-+  return 0UL;
-+  return 0LL;
-+  return (char) 0;
-+  return (bool) 0;
-+  return (enum e) 0;
-+  return false;
-+  return BZERO;
-+  return (enum e2) 0;
-+  return LZERO;
-+  return (enum e3) 0;
-+#ifdef __BITINT_MAXWIDTH__
-+  return 0wb;
-+  return 0uwb;
-+#endif
-+}
--- 
-2.47.0

diff --git a/sys-devel/gcc/gcc-15.0.0_pre20241117-r2.ebuild b/sys-devel/gcc/gcc-15.0.0_pre20241117-r2.ebuild
deleted file mode 100644
index ee327823124e..000000000000
--- a/sys-devel/gcc/gcc-15.0.0_pre20241117-r2.ebuild
+++ /dev/null
@@ -1,54 +0,0 @@
-# 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="26"
-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}-PR112556-c-Allow-bool-and-enum-null-pointer-constants.patch
-	eapply_user
-}

diff --git a/sys-devel/gcc/gcc-15.0.0_pre20241124.ebuild b/sys-devel/gcc/gcc-15.0.0_pre20241124.ebuild
deleted file mode 100644
index 75125b880bdc..000000000000
--- a/sys-devel/gcc/gcc-15.0.0_pre20241124.ebuild
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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="28"
-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_user
-}

diff --git a/sys-devel/gcc/gcc-15.0.0_pre20241201.ebuild b/sys-devel/gcc/gcc-15.0.0_pre20241201.ebuild
deleted file mode 100644
index 7c6295bee00e..000000000000
--- a/sys-devel/gcc/gcc-15.0.0_pre20241201.ebuild
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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="29"
-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_user
-}

diff --git a/sys-devel/gcc/gcc-15.0.0_pre20241208-r1.ebuild b/sys-devel/gcc/gcc-15.0.0_pre20241208-r1.ebuild
deleted file mode 100644
index 4480a9356d92..000000000000
--- a/sys-devel/gcc/gcc-15.0.0_pre20241208-r1.ebuild
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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="31"
-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_user
-}

diff --git a/sys-devel/gcc/gcc-15.0.0_pre20241208.ebuild b/sys-devel/gcc/gcc-15.0.0_pre20241208.ebuild
deleted file mode 100644
index 287aa403a70f..000000000000
--- a/sys-devel/gcc/gcc-15.0.0_pre20241208.ebuild
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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="30"
-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_user
-}

diff --git a/sys-devel/gcc/gcc-15.0.0_pre20241215.ebuild b/sys-devel/gcc/gcc-15.0.0_pre20241215.ebuild
deleted file mode 100644
index 667d7ee4ba29..000000000000
--- a/sys-devel/gcc/gcc-15.0.0_pre20241215.ebuild
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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="32"
-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_user
-}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2025-02-15  4:01 Sam James
  0 siblings, 0 replies; 13+ messages in thread
From: Sam James @ 2025-02-15  4:01 UTC (permalink / raw
  To: gentoo-commits

commit:     ef046b47103e5ed2936c4050465416a93b84d232
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 15 03:58:52 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Feb 15 04:01:14 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef046b47

sys-devel/gcc: backport two fixes to 15.0.1_pre20250209

* Backport the -fno-range-for-ext-temps default change which fixes/works around
  miscompilation of coroutines including in KDE Plasma.

  There's more fixes for making it work but they had some followups so
  better to wait for the next snapshot for that. So we pick the conservative
  option here with the best bang-for-buck.

* Fix MariaDB compilation.

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

 .../gcc/files/gcc-15.0.1_pre20250209-coro.patch    | 124 +++++
 .../gcc-15.0.1_pre20250209-range-for-mariadb.patch | 530 +++++++++++++++++++++
 ...209.ebuild => gcc-15.0.1_pre20250209-r1.ebuild} |   2 +
 3 files changed, 656 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-15.0.1_pre20250209-coro.patch b/sys-devel/gcc/files/gcc-15.0.1_pre20250209-coro.patch
new file mode 100644
index 000000000000..bc51deefafe7
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-15.0.1_pre20250209-coro.patch
@@ -0,0 +1,124 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=556248d7d2cf557423993eb68f6a55ae6bda0cee
+
+From 556248d7d2cf557423993eb68f6a55ae6bda0cee Mon Sep 17 00:00:00 2001
+From: Jason Merrill <jason@redhat.com>
+Date: Tue, 11 Feb 2025 13:51:32 +0100
+Subject: [PATCH] c++: don't default -frange-for-ext-temps in -std=gnu++20
+ [PR188574]
+
+Since -frange-for-ext-temps has been causing trouble, let's not enable it
+by default in pre-C++23 GNU modes for GCC 15, and also allow disabling it in
+C++23 and up.
+
+	PR c++/188574
+
+gcc/c-family/ChangeLog:
+
+	* c-opts.cc (c_common_post_options): Only enable
+	-frange-for-ext-temps by default in C++23.
+
+gcc/ChangeLog:
+
+	* doc/invoke.texi: Adjust -frange-for-ext-temps documentation.
+
+gcc/testsuite/ChangeLog:
+
+	* g++.dg/cpp23/range-for3.C: Use -frange-for-ext-temps.
+	* g++.dg/cpp23/range-for4.C: Adjust expected result.
+
+libgomp/ChangeLog:
+
+	* testsuite/libgomp.c++/range-for-4.C: Adjust expected result.
+---
+ gcc/c-family/c-opts.cc                      | 17 +++--------------
+ gcc/doc/invoke.texi                         |  5 ++---
+ gcc/testsuite/g++.dg/cpp23/range-for3.C     |  4 ++--
+ gcc/testsuite/g++.dg/cpp23/range-for4.C     |  4 ++--
+ libgomp/testsuite/libgomp.c++/range-for-4.C |  2 +-
+ 5 files changed, 10 insertions(+), 22 deletions(-)
+
+diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
+index 87b231861a64..d43b3aef1024 100644
+--- a/gcc/c-family/c-opts.cc
++++ b/gcc/c-family/c-opts.cc
+@@ -1213,20 +1213,9 @@ c_common_post_options (const char **pfilename)
+   if (cxx_dialect >= cxx20)
+     flag_concepts = 1;
+ 
+-  /* Enable lifetime extension of range based for temporaries for C++23.
+-     Diagnose -std=c++23 -fno-range-for-ext-temps.  */
+-  if (cxx_dialect >= cxx23)
+-    {
+-      if (OPTION_SET_P (flag_range_for_ext_temps)
+-	  && !flag_range_for_ext_temps)
+-	error ("%<-fno-range-for-ext-temps%> is incompatible with C++23");
+-      flag_range_for_ext_temps = 1;
+-    }
+-  /* Otherwise default to enabled in GNU modes but allow user to override.  */
+-  else if (cxx_dialect >= cxx11
+-	   && !flag_iso
+-	   && !OPTION_SET_P (flag_range_for_ext_temps))
+-    flag_range_for_ext_temps = 1;
++  /* Enable lifetime extension of range based for temporaries for C++23.  */
++  SET_OPTION_IF_UNSET (&global_options, &global_options_set,
++		       flag_range_for_ext_temps, cxx_dialect >= cxx23);
+ 
+   /* -fimmediate-escalation has no effect when immediate functions are not
+      supported.  */
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index 0aef2abf05b9..56d43cb67796 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -3548,9 +3548,8 @@ easier, you can use @option{-fno-pretty-templates} to disable them.
+ Enable lifetime extension of C++ range based for temporaries.
+ With @option{-std=c++23} and above this is part of the language standard,
+ so lifetime of the temporaries is extended until the end of the loop
+-regardless of this option.  This option allows enabling that behavior also
+-in earlier versions of the standard and is enabled by default in the
+-GNU dialects, from @option{-std=gnu++11} until @option{-std=gnu++20}.
++by default.  This option allows enabling that behavior also
++in earlier versions of the standard.
+ 
+ @opindex fno-rtti
+ @opindex frtti
+diff --git a/gcc/testsuite/g++.dg/cpp23/range-for3.C b/gcc/testsuite/g++.dg/cpp23/range-for3.C
+index 301e25886ec6..f95b21b3ceee 100644
+--- a/gcc/testsuite/g++.dg/cpp23/range-for3.C
++++ b/gcc/testsuite/g++.dg/cpp23/range-for3.C
+@@ -1,7 +1,7 @@
+ // P2718R0 - Wording for P2644R1 Fix for Range-based for Loop
+ // { dg-do run { target c++11 } }
+-// Verify -frange-for-ext-temps is set by default in -std=gnu++* modes.
+-// { dg-options "" }
++// Verify -frange-for-ext-temps works in earlier standards.
++// { dg-additional-options "-frange-for-ext-temps" }
+ 
+ #define RANGE_FOR_EXT_TEMPS 1
+ #include "range-for1.C"
+diff --git a/gcc/testsuite/g++.dg/cpp23/range-for4.C b/gcc/testsuite/g++.dg/cpp23/range-for4.C
+index f8c380d32c72..16204974bac9 100644
+--- a/gcc/testsuite/g++.dg/cpp23/range-for4.C
++++ b/gcc/testsuite/g++.dg/cpp23/range-for4.C
+@@ -1,7 +1,7 @@
+ // P2718R0 - Wording for P2644R1 Fix for Range-based for Loop
+ // { dg-do run { target c++11 } }
+-// Verify -frange-for-ext-temps is set by default in -std=gnu++* modes.
++// Verify -frange-for-ext-temps is not set by default in -std=gnu++* modes.
+ // { dg-options "" }
+ 
+-#define RANGE_FOR_EXT_TEMPS 1
++#define RANGE_FOR_EXT_TEMPS 0
+ #include "range-for2.C"
+diff --git a/libgomp/testsuite/libgomp.c++/range-for-4.C b/libgomp/testsuite/libgomp.c++/range-for-4.C
+index 3c10e7349af7..aa6e4da523c1 100644
+--- a/libgomp/testsuite/libgomp.c++/range-for-4.C
++++ b/libgomp/testsuite/libgomp.c++/range-for-4.C
+@@ -3,5 +3,5 @@
+ // { dg-additional-options "-std=gnu++17" }
+ // { dg-require-effective-target tls_runtime }
+ 
+-#define RANGE_FOR_EXT_TEMPS 1
++#define RANGE_FOR_EXT_TEMPS 0
+ #include "range-for-1.C"
+-- 
+2.43.5

diff --git a/sys-devel/gcc/files/gcc-15.0.1_pre20250209-range-for-mariadb.patch b/sys-devel/gcc/files/gcc-15.0.1_pre20250209-range-for-mariadb.patch
new file mode 100644
index 000000000000..8ffe1b558b2e
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-15.0.1_pre20250209-range-for-mariadb.patch
@@ -0,0 +1,530 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=26baa2c09b39abf037afad349a318dc5734eae25
+
+From 26baa2c09b39abf037afad349a318dc5734eae25 Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Thu, 13 Feb 2025 10:21:29 +0100
+Subject: [PATCH] c++: Fix up regressions caused by for/while loops with
+ declarations [PR118822]
+
+The recent PR86769 r15-7426 changes regressed the following two testcases,
+the first one is more important as it is derived from real-world code.
+
+The first problem is that the chosen
+prep = do_pushlevel (sk_block);
+// emit something
+body = push_stmt_list ();
+// emit further stuff
+body = pop_stmt_list (body);
+prep = do_poplevel (prep);
+way of constructing the {FOR,WHILE}_COND_PREP and {FOR,WHILE}_BODY
+isn't reliable.  If during parsing a label is seen in the body and then
+some decl with destructors, sk_cleanup transparent scope is added, but
+the correspondiong result from push_stmt_list is saved in
+*current_binding_level and pop_stmt_list then pops even that statement list
+but only do_poplevel actually attempts to pop the sk_cleanup scope and so we
+ICE.
+The reason for not doing do_pushlevel (sk_block); do_pushlevel (sk_block);
+is that variables should be in the same scope (otherwise various e.g.
+redeclaration*.C tests FAIL) and doing do_pushlevel (sk_block); do_pushlevel
+(sk_cleanup); wouldn't work either as do_poplevel would silently unwind even
+the cleanup one.
+
+The second problem is that my assumption that the declaration in the
+condition will have zero or one cleanup is just wrong, at least for
+structured bindings used as condition, there can be as many cleanups as
+there are names in the binding + 1.
+
+So, the following patch changes the earlier approach.  Nothing is removed
+from the {FOR,WHILE}_COND_PREP subtrees while doing adjust_loop_decl_cond,
+push_stmt_list isn't called either; all it does is remember as an integer
+the number of cleanups (CLEANUP_STMT at the end of the STATEMENT_LISTs)
+from querying stmt_list_stack and finding the initial *body_p in there
+(that integer is stored into {FOR,WHILE}_COND_CLEANUP), and temporarily
+{FOR,WHILE}_BODY is set to the last statement (if any) in the innermost
+STATEMENT_LIST at the adjust_loop_decl_cond time; then at
+finish_{for,while}_stmt a new finish_loop_cond_prep routine takes care of
+do_poplevel for the scope (which is in {FOR,WHILE}_COND_PREP) and finds
+given {FOR,WHILE}_COND_CLEANUP number and {FOR,WHILE}_BODY tree the right
+spot where body statements start and moves that into {FOR,WHILE}_BODY.
+Finally genericize_c_loop then inserts the cond, body, continue label, expr
+into the right subtree of {FOR,WHILE}_COND_PREP.
+The constexpr evaluation unfortunately had to be changed as well, because
+we don't want to evaluate everything in BIND_EXPR_BODY (*_COND_PREP ())
+right away, we want to evaluate it with the exception of the CLEANUP_STMT
+cleanups at the end (given {FOR,WHILE}_COND_CLEANUP levels), and defer
+the evaluation of the cleanups until after cond, body, expr are evaluated.
+
+2025-02-13  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c++/118822
+	PR c++/118833
+gcc/
+	* tree-iterator.h (tsi_split_stmt_list): Declare.
+	* tree-iterator.cc (tsi_split_stmt_list): New function.
+gcc/c-family/
+	* c-common.h (WHILE_COND_CLEANUP): Change description in comment.
+	(FOR_COND_CLEANUP): Likewise.
+	* c-gimplify.cc (genericize_c_loop): Adjust for COND_CLEANUP
+	being CLEANUP_STMT/TRY_FINALLY_EXPR trailing nesting depth
+	instead of actual cleanup.
+gcc/cp/
+	* semantics.cc (adjust_loop_decl_cond): Allow multiple trailing
+	CLEANUP_STMT levels in *BODY_P.  Set *CLEANUP_P to the number
+	of levels rather than one particular cleanup, keep the cleanups
+	in *PREP_P.  Set *BODY_P to the last stmt in the cur_stmt_list
+	or NULL if *CLEANUP_P and the innermost cur_stmt_list is empty.
+	(finish_loop_cond_prep): New function.
+	(finish_while_stmt, finish_for_stmt): Use it.  Don't call
+	set_one_cleanup_loc.
+	* constexpr.cc (cxx_eval_loop_expr): Adjust handling of
+	{FOR,WHILE}_COND_{PREP,CLEANUP}.
+gcc/testsuite/
+	* g++.dg/expr/for9.C: New test.
+	* g++.dg/cpp26/decomp12.C: New test.
+---
+ gcc/c-family/c-common.h               |   6 +-
+ gcc/c-family/c-gimplify.cc            |  41 +++------
+ gcc/cp/constexpr.cc                   |  97 +++++++++++++++++--
+ gcc/cp/semantics.cc                   | 128 +++++++++++++++++++-------
+ gcc/testsuite/g++.dg/cpp26/decomp12.C |  46 +++++++++
+ gcc/testsuite/g++.dg/expr/for9.C      |  25 +++++
+ gcc/tree-iterator.cc                  |  22 +++++
+ gcc/tree-iterator.h                   |   1 +
+ 8 files changed, 297 insertions(+), 69 deletions(-)
+ create mode 100644 gcc/testsuite/g++.dg/cpp26/decomp12.C
+ create mode 100644 gcc/testsuite/g++.dg/expr/for9.C
+
+diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
+index bc238430b7a7..ea6c29750567 100644
+--- a/gcc/c-family/c-common.h
++++ b/gcc/c-family/c-common.h
+@@ -1518,7 +1518,8 @@ extern tree build_userdef_literal (tree suffix_id, tree value,
+ 
+ /* WHILE_STMT accessors.  These give access to the condition of the
+    while statement, the body, and name of the while statement, and
+-   condition preparation statements and its cleanup, respectively.  */
++   condition preparation statements and number of its nested cleanups,
++   respectively.  */
+ #define WHILE_COND(NODE)	TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0)
+ #define WHILE_BODY(NODE)	TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1)
+ #define WHILE_NAME(NODE)	TREE_OPERAND (WHILE_STMT_CHECK (NODE), 2)
+@@ -1533,7 +1534,8 @@ extern tree build_userdef_literal (tree suffix_id, tree value,
+ 
+ /* FOR_STMT accessors.  These give access to the init statement,
+    condition, update expression, body and name of the for statement,
+-   and condition preparation statements and its cleanup, respectively.  */
++   and condition preparation statements and number of its nested cleanups,
++   respectively.  */
+ #define FOR_INIT_STMT(NODE)	TREE_OPERAND (FOR_STMT_CHECK (NODE), 0)
+ #define FOR_COND(NODE)		TREE_OPERAND (FOR_STMT_CHECK (NODE), 1)
+ #define FOR_EXPR(NODE)		TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
+diff --git a/gcc/c-family/c-gimplify.cc b/gcc/c-family/c-gimplify.cc
+index d53e0c2dc567..dc5e80dfa6be 100644
+--- a/gcc/c-family/c-gimplify.cc
++++ b/gcc/c-family/c-gimplify.cc
+@@ -258,8 +258,10 @@ expr_loc_or_loc (const_tree expr, location_t or_loc)
+    for C++ for/while loops with variable declaration as condition.  COND_PREP
+    is a BIND_EXPR with the declaration and initialization of the condition
+    variable, into which COND, BODY, continue label if needed and INCR if
+-   non-NULL should be appended, and COND_CLEANUP are statements which should
+-   be evaluated after that or if anything in COND, BODY or INCR throws.  */
++   non-NULL should be appended, and COND_CLEANUP is number of nested
++   CLEANUP_STMT -> TRY_FINALLY_EXPR statements at the end.  If non-NULL,
++   COND, BODY, continue label if needed and INCR if non-NULL should be
++   appended to the body of the COND_CLEANUP's nested TRY_FINALLY_EXPR.  */
+ 
+ static void
+ genericize_c_loop (tree *stmt_p, location_t start_locus, tree cond, tree body,
+@@ -278,7 +280,6 @@ genericize_c_loop (tree *stmt_p, location_t start_locus, tree cond, tree body,
+   walk_tree_1 (&cond_prep, func, data, NULL, lh);
+   walk_tree_1 (&cond, func, data, NULL, lh);
+   walk_tree_1 (&incr, func, data, NULL, lh);
+-  walk_tree_1 (&cond_cleanup, func, data, NULL, lh);
+ 
+   blab = begin_bc_block (bc_break, start_locus);
+   clab = begin_bc_block (bc_continue, start_locus);
+@@ -309,36 +310,24 @@ genericize_c_loop (tree *stmt_p, location_t start_locus, tree cond, tree body,
+ 	 EXPR;
+ 	 goto top;
+ 
+-	 or
+-
+-	 try {
+-	   if (COND); else break;
+-	   BODY;
+-	   cont:
+-	   EXPR;
+-	 } finally {
+-	   COND_CLEANUP
+-	 }
+-
+-	 appended into COND_PREP body.  */
++	 appended into COND_PREP body or body of some TRY_FINALLY_EXPRs
++	 at the end of COND_PREP.  */
+       gcc_assert (cond_is_first && TREE_CODE (cond_prep) == BIND_EXPR);
+       tree top = build1 (LABEL_EXPR, void_type_node,
+ 			 create_artificial_label (start_locus));
+       exit = build1 (GOTO_EXPR, void_type_node, LABEL_EXPR_LABEL (top));
+       append_to_statement_list (top, &outer_stmt_list);
+       append_to_statement_list (cond_prep, &outer_stmt_list);
+-      stmt_list = BIND_EXPR_BODY (cond_prep);
+-      BIND_EXPR_BODY (cond_prep) = NULL_TREE;
+       stmt_list_p = &BIND_EXPR_BODY (cond_prep);
+-      if (cond_cleanup && TREE_SIDE_EFFECTS (cond_cleanup))
+-	{
+-	  t = build2_loc (EXPR_LOCATION (cond_cleanup), TRY_FINALLY_EXPR,
+-			  void_type_node, NULL_TREE, cond_cleanup);
+-	  append_to_statement_list (t, &stmt_list);
+-	  *stmt_list_p = stmt_list;
+-	  stmt_list_p = &TREE_OPERAND (t, 0);
+-	  stmt_list = NULL_TREE;
+-	}
++      if (cond_cleanup)
++	for (unsigned depth = tree_to_uhwi (cond_cleanup); depth; --depth)
++	  {
++	    t = tsi_stmt (tsi_last (*stmt_list_p));
++	    gcc_assert (TREE_CODE (t) == TRY_FINALLY_EXPR);
++	    stmt_list_p = &TREE_OPERAND (t, 0);
++	  }
++      stmt_list = *stmt_list_p;
++      *stmt_list_p = NULL_TREE;
+       tree after_cond = create_artificial_label (cond_locus);
+       tree goto_after_cond = build1 (GOTO_EXPR, void_type_node, after_cond);
+       t = build1 (GOTO_EXPR, void_type_node, get_bc_label (bc_break));
+diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
+index f142dd32bc80..299b13456873 100644
+--- a/gcc/cp/constexpr.cc
++++ b/gcc/cp/constexpr.cc
+@@ -7153,6 +7153,7 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree t,
+ 
+   tree body, cond = NULL_TREE, expr = NULL_TREE;
+   tree cond_prep = NULL_TREE, cond_cleanup = NULL_TREE;
++  unsigned cond_cleanup_depth = 0;
+   int count = 0;
+   switch (TREE_CODE (t))
+     {
+@@ -7188,11 +7189,25 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree t,
+     }
+   if (cond_prep)
+     gcc_assert (TREE_CODE (cond_prep) == BIND_EXPR);
+-  auto cleanup_cond = [=] {
++  auto cleanup_cond = [&] {
+     /* Clean up the condition variable after each iteration.  */
+-    if (cond_cleanup && !*non_constant_p)
+-      cxx_eval_constant_expression (ctx, cond_cleanup, vc_discard,
+-				    non_constant_p, overflow_p);
++    if (cond_cleanup_depth && !*non_constant_p)
++      {
++	auto_vec<tree, 4> cleanups (cond_cleanup_depth);
++	tree s = BIND_EXPR_BODY (cond_prep);
++	unsigned i;
++	for (i = cond_cleanup_depth; i; --i)
++	  {
++	    tree_stmt_iterator iter = tsi_last (s);
++	    s = tsi_stmt (iter);
++	    cleanups.quick_push (CLEANUP_EXPR (s));
++	    s = CLEANUP_BODY (s);
++	  }
++	tree c;
++	FOR_EACH_VEC_ELT_REVERSE (cleanups, i, c)
++	  cxx_eval_constant_expression (ctx, c, vc_discard, non_constant_p,
++					overflow_p);
++      }
+     if (cond_prep)
+       for (tree decl = BIND_EXPR_VARS (cond_prep);
+ 	   decl; decl = DECL_CHAIN (decl))
+@@ -7227,9 +7242,77 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree t,
+ 	  for (tree decl = BIND_EXPR_VARS (cond_prep);
+ 	       decl; decl = DECL_CHAIN (decl))
+ 	    ctx->global->clear_value (decl);
+-	  cxx_eval_constant_expression (ctx, BIND_EXPR_BODY (cond_prep),
+-					vc_discard, non_constant_p,
+-					overflow_p, jump_target);
++	  if (cond_cleanup)
++	    {
++	      /* If COND_CLEANUP is non-NULL, we need to evaluate DEPTH
++		 nested STATEMENT_LISTs from inside of BIND_EXPR_BODY,
++		 but defer the evaluation of CLEANUP_EXPRs of CLEANUP_STMT
++		 at the end of those STATEMENT_LISTs.  */
++	      cond_cleanup_depth = 0;
++	      tree s = BIND_EXPR_BODY (cond_prep);
++	      for (unsigned depth = tree_to_uhwi (cond_cleanup);
++		   depth; --depth)
++		{
++		  for (tree_stmt_iterator i = tsi_start (s);
++		       !tsi_end_p (i); ++i)
++		    {
++		      tree stmt = *i;
++		      if (TREE_CODE (stmt) == DEBUG_BEGIN_STMT)
++			continue;
++		      if (tsi_one_before_end_p (i))
++			{
++			  /* The last statement in the STATEMENT_LIST
++			     has to be a CLEANUP_STMT (verified in
++			     finish_loop_cond_prep).  We want to
++			     evaluate just its CLEANUP_BODY part but not
++			     CLEANUP_EXPR part just yet.  */
++			  gcc_assert (TREE_CODE (stmt) == CLEANUP_STMT);
++			  /* If the CLEANUP_STMT is not actually to be
++			     evaluated, don't increment cond_cleanup_depth
++			     so that we don't evaluate the CLEANUP_EXPR
++			     for it later either.  */
++			  if (*jump_target)
++			    {
++			      depth = 1;
++			      break;
++			    }
++			  ++cond_cleanup_depth;
++			  /* If not in the innermost one, next iteration
++			     will handle CLEANUP_BODY similarly.  */
++			  if (depth > 1)
++			    {
++			      s = CLEANUP_BODY (stmt);
++			      break;
++			    }
++			  /* The innermost one can be evaluated normally.  */
++			  cxx_eval_constant_expression (ctx,
++							CLEANUP_BODY (stmt),
++							vc_discard,
++							non_constant_p,
++							overflow_p,
++							jump_target);
++			  break;
++			}
++		      /* And so should be evaluated statements which aren't
++			 last in the STATEMENT_LIST.  */
++		      cxx_eval_constant_expression (ctx, stmt, vc_discard,
++						    non_constant_p, overflow_p,
++						    jump_target);
++		      if (*non_constant_p
++			  || returns (jump_target)
++			  || breaks (jump_target)
++			  || continues (jump_target))
++			{
++			  depth = 1;
++			  break;
++			}
++		    }
++		}
++	    }
++	  else
++	    cxx_eval_constant_expression (ctx, BIND_EXPR_BODY (cond_prep),
++					  vc_discard, non_constant_p,
++					  overflow_p, jump_target);
+ 	}
+ 
+       if (cond)
+diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
+index 8a2d86576fb0..7c7d3e3c4326 100644
+--- a/gcc/cp/semantics.cc
++++ b/gcc/cp/semantics.cc
+@@ -790,8 +790,8 @@ finish_cond (tree *cond_p, tree expr)
+ 	    while (A x = 42) { }
+ 	    for (; A x = 42;) { }
+    move the *BODY_P statements as a BIND_EXPR into {FOR,WHILE}_COND_PREP
+-   and if there is any CLEANUP_STMT at the end, remove that and
+-   put the cleanup into {FOR,WHILE}_COND_CLEANUP.
++   and if there are any CLEANUP_STMT at the end, remember their count in
++   {FOR,WHILE}_COND_CLEANUP.
+    genericize_c_loop will then handle it appropriately.  In particular,
+    the {FOR,WHILE}_COND, {FOR,WHILE}_BODY, if used continue label and
+    FOR_EXPR will be appended into the {FOR,WHILE}_COND_PREP BIND_EXPR,
+@@ -807,26 +807,88 @@ adjust_loop_decl_cond (tree *body_p, tree *prep_p, tree *cleanup_p)
+     return;
+ 
+   gcc_assert (!processing_template_decl);
+-  if (*body_p != cur_stmt_list)
+-    {
+-      /* There can be either no cleanup at all, if the condition
+-	 declaration doesn't have non-trivial destructor, or a single
+-	 one if it does.  In that case extract it into *CLEANUP_P.  */
+-      gcc_assert (stmt_list_stack->length () > 1
+-		  && (*stmt_list_stack)[stmt_list_stack->length ()
+-					- 2] == *body_p);
+-      tree_stmt_iterator last = tsi_last (*body_p);
+-      gcc_assert (tsi_one_before_end_p (last)
+-		  && TREE_CODE (tsi_stmt (last)) == CLEANUP_STMT
+-		  && CLEANUP_BODY (tsi_stmt (last)) == cur_stmt_list
+-		  && tsi_end_p (tsi_last (cur_stmt_list))
+-		  && !CLEANUP_EH_ONLY (tsi_stmt (last)));
+-      *cleanup_p = CLEANUP_EXPR (tsi_stmt (last));
+-      tsi_delink (&last);
++  *prep_p = *body_p;
++  if (*prep_p != cur_stmt_list)
++    {
++      /* There can be just one CLEANUP_STMT, or there could be multiple
++	 nested CLEANUP_STMTs, e.g. for structured bindings used as
++	 condition.  */
++      gcc_assert (stmt_list_stack->length () > 1);
++      for (unsigned i = stmt_list_stack->length () - 2; ; --i)
++	{
++	  tree t = (*stmt_list_stack)[i];
++	  tree_stmt_iterator last = tsi_last (t);
++	  gcc_assert (tsi_one_before_end_p (last)
++		      && TREE_CODE (tsi_stmt (last)) == CLEANUP_STMT
++		      && (CLEANUP_BODY (tsi_stmt (last))
++			  == (*stmt_list_stack)[i + 1])
++		      && !CLEANUP_EH_ONLY (tsi_stmt (last)));
++	  if (t == *prep_p)
++	    {
++	      *cleanup_p = build_int_cst (long_unsigned_type_node,
++					  stmt_list_stack->length () - 1 - i);
++	      break;
++	    }
++	  gcc_assert (i >= 1);
++	}
+     }
+   current_binding_level->keep = true;
+-  *prep_p = *body_p;
+-  *body_p = push_stmt_list ();
++  tree_stmt_iterator iter = tsi_last (cur_stmt_list);
++  /* Temporarily store in {FOR,WHILE}_BODY the last statement of
++     the innnermost statement list or NULL if it has no statement.
++     This is used in finish_loop_cond_prep to find out the splitting
++     point and then {FOR,WHILE}_BODY will be changed to the actual
++     body.  */
++  if (tsi_end_p (iter))
++    *body_p = NULL_TREE;
++  else
++    *body_p = tsi_stmt (iter);
++}
++
++/* Finalize {FOR,WHILE}_{BODY,COND_PREP} after the loop body.
++   The above function initialized *BODY_P to the last statement
++   in *PREP_P at that point.
++   Call do_poplevel on *PREP_P and move everything after that
++   former last statement into *BODY_P.  genericize_c_loop
++   will later put those parts back together.
++   CLEANUP is {FOR,WHILE}_COND_CLEANUP.  */
++
++static void
++finish_loop_cond_prep (tree *body_p, tree *prep_p, tree cleanup)
++{
++  *prep_p = do_poplevel (*prep_p);
++  gcc_assert (TREE_CODE (*prep_p) == BIND_EXPR);
++  if (BIND_EXPR_BODY (*prep_p) == *body_p)
++    {
++      gcc_assert (cleanup == NULL_TREE);
++      *body_p = build_empty_stmt (input_location);
++      return;
++    }
++  tree stmt_list = BIND_EXPR_BODY (*prep_p);
++  gcc_assert (TREE_CODE (stmt_list) == STATEMENT_LIST);
++  if (cleanup)
++    {
++      tree_stmt_iterator iter = tsi_last (stmt_list);
++      gcc_assert (TREE_CODE (tsi_stmt (iter)) == CLEANUP_STMT);
++      for (unsigned depth = tree_to_uhwi (cleanup); depth > 1; --depth)
++	{
++	  gcc_assert (TREE_CODE (CLEANUP_BODY (tsi_stmt (iter)))
++		      == STATEMENT_LIST);
++	  iter = tsi_last (CLEANUP_BODY (tsi_stmt (iter)));
++	  gcc_assert (TREE_CODE (tsi_stmt (iter)) == CLEANUP_STMT);
++	}
++      if (*body_p == NULL_TREE)
++	{
++	  *body_p = CLEANUP_BODY (tsi_stmt (iter));
++	  CLEANUP_BODY (tsi_stmt (iter)) = build_empty_stmt (input_location);
++	  return;
++	}
++      stmt_list = CLEANUP_BODY (tsi_stmt (iter));
++    }
++  tree_stmt_iterator iter = tsi_start (stmt_list);
++  while (tsi_stmt (iter) != *body_p)
++    tsi_next (&iter);
++  *body_p = tsi_split_stmt_list (input_location, iter);
+ }
+ 
+ /* Finish a goto-statement.  */
+@@ -1437,14 +1499,13 @@ void
+ finish_while_stmt (tree while_stmt)
+ {
+   end_maybe_infinite_loop (boolean_true_node);
+-  WHILE_BODY (while_stmt)
+-    = (WHILE_COND_PREP (while_stmt)
+-       ? pop_stmt_list (WHILE_BODY (while_stmt))
+-       : do_poplevel (WHILE_BODY (while_stmt)));
+-  finish_loop_cond (&WHILE_COND (while_stmt), WHILE_BODY (while_stmt));
+   if (WHILE_COND_PREP (while_stmt))
+-    WHILE_COND_PREP (while_stmt) = do_poplevel (WHILE_COND_PREP (while_stmt));
+-  set_one_cleanup_loc (WHILE_COND_CLEANUP (while_stmt), input_location);
++    finish_loop_cond_prep (&WHILE_BODY (while_stmt),
++			   &WHILE_COND_PREP (while_stmt),
++			   WHILE_COND_CLEANUP (while_stmt));
++  else
++    WHILE_BODY (while_stmt) = do_poplevel (WHILE_BODY (while_stmt));
++  finish_loop_cond (&WHILE_COND (while_stmt), WHILE_BODY (while_stmt));
+ }
+ 
+ /* Begin a do-statement.  Returns a newly created DO_STMT if
+@@ -1709,17 +1770,16 @@ finish_for_stmt (tree for_stmt)
+     RANGE_FOR_BODY (for_stmt) = do_poplevel (RANGE_FOR_BODY (for_stmt));
+   else
+     {
+-      FOR_BODY (for_stmt)
+-	= (FOR_COND_PREP (for_stmt)
+-	   ? pop_stmt_list (FOR_BODY (for_stmt))
+-	   : do_poplevel (FOR_BODY (for_stmt)));
++      if (FOR_COND_PREP (for_stmt))
++	finish_loop_cond_prep (&FOR_BODY (for_stmt),
++			       &FOR_COND_PREP (for_stmt),
++			       FOR_COND_CLEANUP (for_stmt));
++      else
++	FOR_BODY (for_stmt) = do_poplevel (FOR_BODY (for_stmt));
+       if (FOR_COND (for_stmt))
+ 	finish_loop_cond (&FOR_COND (for_stmt),
+ 			  FOR_EXPR (for_stmt) ? integer_one_node
+ 					      : FOR_BODY (for_stmt));
+-      if (FOR_COND_PREP (for_stmt))
+-	FOR_COND_PREP (for_stmt) = do_poplevel (FOR_COND_PREP (for_stmt));
+-      set_one_cleanup_loc (FOR_COND_CLEANUP (for_stmt), input_location);
+     }
+ 
+   /* Pop the scope for the body of the loop.  */
+diff --git a/gcc/tree-iterator.cc b/gcc/tree-iterator.cc
+index db2219c62489..b7e2b421c5ee 100644
+--- a/gcc/tree-iterator.cc
++++ b/gcc/tree-iterator.cc
+@@ -284,6 +284,28 @@ tsi_delink (tree_stmt_iterator *i)
+   i->ptr = next;
+ }
+ 
++/* Split a STATEMENT_LIST in I.contrainer into two, all statements
++   from the start until I.ptr inclusive will remain in the original
++   one, all statements after I.ptr are removed from that STATEMENT_LIST
++   and returned as a new STATEMENT_LIST.  If I is the last statement,
++   an empty statement with LOC location is returned.  */
++
++tree
++tsi_split_stmt_list (location_t loc, tree_stmt_iterator i)
++{
++  if (tsi_one_before_end_p (i))
++    return build_empty_stmt (loc);
++  tsi_next (&i);
++  tree ret = NULL_TREE;
++  while (!tsi_end_p (i))
++    {
++      tree t = tsi_stmt (i);
++      tsi_delink (&i);
++      append_to_statement_list_force (t, &ret);
++    }
++  return ret;
++}
++
+ /* Return the first expression in a sequence of COMPOUND_EXPRs, or in
+    a STATEMENT_LIST, disregarding DEBUG_BEGIN_STMTs, recursing into a
+    STATEMENT_LIST if that's the first non-DEBUG_BEGIN_STMT.  */
+diff --git a/gcc/tree-iterator.h b/gcc/tree-iterator.h
+index 27795e9ee2b8..d1bc9014c65b 100644
+--- a/gcc/tree-iterator.h
++++ b/gcc/tree-iterator.h
+@@ -138,6 +138,7 @@ extern void tsi_link_after (tree_stmt_iterator *, tree,
+ 			    enum tsi_iterator_update);
+ 
+ extern void tsi_delink (tree_stmt_iterator *);
++extern tree tsi_split_stmt_list (location_t, tree_stmt_iterator);
+ 
+ extern tree alloc_stmt_list (void);
+ extern void free_stmt_list (tree);
+-- 
+2.43.5

diff --git a/sys-devel/gcc/gcc-15.0.1_pre20250209.ebuild b/sys-devel/gcc/gcc-15.0.1_pre20250209-r1.ebuild
similarity index 93%
rename from sys-devel/gcc/gcc-15.0.1_pre20250209.ebuild
rename to sys-devel/gcc/gcc-15.0.1_pre20250209-r1.ebuild
index 55be6a99ea8d..c30b842f308f 100644
--- a/sys-devel/gcc/gcc-15.0.1_pre20250209.ebuild
+++ b/sys-devel/gcc/gcc-15.0.1_pre20250209-r1.ebuild
@@ -50,4 +50,6 @@ src_prepare() {
 	toolchain_src_prepare
 
 	eapply_user
+	eapply "${FILESDIR}"/${P}-coro.patch
+	eapply "${FILESDIR}"/${P}-range-for-mariadb.patch
 }


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

end of thread, other threads:[~2025-02-15  4:01 UTC | newest]

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

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