[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2024-03-07 Thread Sam James
commit: e4dfb164264174461dd6ac8a826fb01b00e5dbf8
Author: Sam James  gentoo  org>
AuthorDate: Thu Mar  7 18:36:18 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Mar  7 18:36:18 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4dfb164

Revert "sys-devel/gcc: drop obsolete cross fixincludes patch for 13"

This reverts commit 456eee6e374b50a4d9108a642ca29c5573ac5cb8.

Restore the fixincludes revert. The situation has improved a bit though,
because we now only run fixincludes when it's truly needed, so having
this patch is less risky to begin with.

Caveat emptor for trying to remove this in future: make sure to test
clean builds without mingw already built, and with.

Bug: https://bugs.gentoo.org/905118
Bug: https://bugs.gentoo.org/925204
Closes: https://bugs.gentoo.org/926059
Signed-off-by: Sam James  gentoo.org>

 .../gcc/files/gcc-13-fix-cross-fixincludes.patch  | 19 +++
 sys-devel/gcc/gcc-12.3.1_p20240223.ebuild |  1 +
 sys-devel/gcc/gcc-12.3.1_p20240301.ebuild |  1 +
 sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild  |  1 +
 sys-devel/gcc/gcc-13.2.1_p20240210.ebuild |  1 +
 sys-devel/gcc/gcc-13.2.1_p20240224.ebuild |  1 +
 sys-devel/gcc/gcc-13.2.1_p20240302.ebuild |  1 +
 sys-devel/gcc/gcc-14.0.1_pre20240225.ebuild   |  1 +
 sys-devel/gcc/gcc-14.0.1_pre20240303-r1.ebuild|  1 +
 9 files changed, 27 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch 
b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
new file mode 100644
index ..e4abe01a0830
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
@@ -0,0 +1,19 @@
+Revert of 
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=59e4c98173a79fcaa2c33253261409f38856c384
+for now to fix cross fixincludes builds.
+
+https://bugs.gentoo.org/905118
+--- a/gcc/Makefile.in
 b/gcc/Makefile.in
+@@ -532,11 +532,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
+ # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
+ NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
+ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
+-ifeq (@includedir@,$(prefix)/include)
+-  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+-else
+-  CROSS_SYSTEM_HEADER_DIR = @includedir@
+-endif
++CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+ 
+ # autoconf sets SYSTEM_HEADER_DIR to one of the above.
+ # Purge it of unnecessary internal relative paths

diff --git a/sys-devel/gcc/gcc-12.3.1_p20240223.ebuild 
b/sys-devel/gcc/gcc-12.3.1_p20240223.ebuild
index 6a9137e1c84d..6a09eedbf172 100644
--- a/sys-devel/gcc/gcc-12.3.1_p20240223.ebuild
+++ b/sys-devel/gcc/gcc-12.3.1_p20240223.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
toolchain_src_prepare
 
+   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git a/sys-devel/gcc/gcc-12.3.1_p20240301.ebuild 
b/sys-devel/gcc/gcc-12.3.1_p20240301.ebuild
index 6a9137e1c84d..6a09eedbf172 100644
--- a/sys-devel/gcc/gcc-12.3.1_p20240301.ebuild
+++ b/sys-devel/gcc/gcc-12.3.1_p20240301.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
toolchain_src_prepare
 
+   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild 
b/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
index 3404c76c9248..7b1015f0e7cd 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
toolchain_src_prepare
 
+   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild 
b/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild
index 865959900de6..012b57185a8a 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
toolchain_src_prepare
 
+   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240224.ebuild 
b/sys-devel/gcc/gcc-13.2.1_p20240224.ebuild
index c4394cbaa0e9..dfdf0151adad 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240224.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240224.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
toolchain_src_prepare
 
+   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240302.ebuild 
b/sys-devel/gcc/gcc-13.2.1_p20240302.ebuild
index c4394cbaa0e9..dfdf0151adad 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240302.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240302.ebuild
@@ -60,5 +60,6 @@ src_prepare() {
 
toolchain_src_prepare
 
+   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2024-02-18 Thread Sam James
commit: 456eee6e374b50a4d9108a642ca29c5573ac5cb8
Author: Sam James  gentoo  org>
AuthorDate: Mon Feb 19 05:05:19 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Feb 19 05:05:36 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=456eee6e

sys-devel/gcc: drop obsolete cross fixincludes patch for 13

We should be able to do this now after 0b75d3ce0bae8240c28c6a8f191f5130548f8475.

Bug: https://bugs.gentoo.org/905118
Signed-off-by: Sam James  gentoo.org>

 .../gcc/files/gcc-13-fix-cross-fixincludes.patch  | 19 ---
 sys-devel/gcc/gcc-13.2.1_p20230826.ebuild |  3 +--
 sys-devel/gcc/gcc-13.2.1_p20231216.ebuild |  3 +--
 sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild  |  1 -
 sys-devel/gcc/gcc-13.2.1_p20240120.ebuild |  1 -
 sys-devel/gcc/gcc-13.2.1_p20240127.ebuild |  1 -
 sys-devel/gcc/gcc-13.2.1_p20240203.ebuild |  1 -
 sys-devel/gcc/gcc-13.2.1_p20240210.ebuild |  1 -
 sys-devel/gcc/gcc-13.2.1_p20240217.ebuild |  1 -
 9 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch 
b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
deleted file mode 100644
index e4abe01a0830..
--- a/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Revert of 
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=59e4c98173a79fcaa2c33253261409f38856c384
-for now to fix cross fixincludes builds.
-
-https://bugs.gentoo.org/905118
 a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -532,11 +532,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
- # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
- NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
- # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
--ifeq (@includedir@,$(prefix)/include)
--  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
--else
--  CROSS_SYSTEM_HEADER_DIR = @includedir@
--endif
-+CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
- 
- # autoconf sets SYSTEM_HEADER_DIR to one of the above.
- # Purge it of unnecessary internal relative paths

diff --git a/sys-devel/gcc/gcc-13.2.1_p20230826.ebuild 
b/sys-devel/gcc/gcc-13.2.1_p20230826.ebuild
index b764492f9a87..55c73d734d7b 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20230826.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20230826.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -60,6 +60,5 @@ src_prepare() {
 
toolchain_src_prepare
 
-   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20231216.ebuild 
b/sys-devel/gcc/gcc-13.2.1_p20231216.ebuild
index a6c1746943ea..3032d482a760 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20231216.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20231216.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -60,6 +60,5 @@ src_prepare() {
 
toolchain_src_prepare
 
-   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild 
b/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
index 7b1015f0e7cd..3404c76c9248 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240113-r1.ebuild
@@ -60,6 +60,5 @@ src_prepare() {
 
toolchain_src_prepare
 
-   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240120.ebuild 
b/sys-devel/gcc/gcc-13.2.1_p20240120.ebuild
index e295e327ec92..68348986bd19 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240120.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240120.ebuild
@@ -60,6 +60,5 @@ src_prepare() {
 
toolchain_src_prepare
 
-   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240127.ebuild 
b/sys-devel/gcc/gcc-13.2.1_p20240127.ebuild
index e295e327ec92..68348986bd19 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240127.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240127.ebuild
@@ -60,6 +60,5 @@ src_prepare() {
 
toolchain_src_prepare
 
-   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240203.ebuild 
b/sys-devel/gcc/gcc-13.2.1_p20240203.ebuild
index e295e327ec92..68348986bd19 100644
--- a/sys-devel/gcc/gcc-13.2.1_p20240203.ebuild
+++ b/sys-devel/gcc/gcc-13.2.1_p20240203.ebuild
@@ -60,6 +60,5 @@ src_prepare() {
 
toolchain_src_prepare
 
-   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }

diff --git a/sys-devel/gcc/gcc-13.2.1_p20240210.ebuild 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2023-10-18 Thread Sam James
commit: 4e374e155734766b5682992ca22c77aef9de1220
Author: Sam James  gentoo  org>
AuthorDate: Wed Oct 18 19:33:33 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Wed Oct 18 19:33:40 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e374e15

sys-devel/gcc: backport pycryptodome ICE fix to 14.0.0_pre20231015

Signed-off-by: Sam James  gentoo.org>

 .../gcc-14.0.0_pre20231015-pycryptodome-ice.patch  | 212 +
 sys-devel/gcc/gcc-14.0.0_pre20231015-r1.ebuild |  65 +++
 2 files changed, 277 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-14.0.0_pre20231015-pycryptodome-ice.patch 
b/sys-devel/gcc/files/gcc-14.0.0_pre20231015-pycryptodome-ice.patch
new file mode 100644
index ..377f68511f78
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-14.0.0_pre20231015-pycryptodome-ice.patch
@@ -0,0 +1,212 @@
+https://gcc.gnu.org/PR111845
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f1744dd50bb1661c98b694ff907cb0a1be4f6134
+
+From f1744dd50bb1661c98b694ff907cb0a1be4f6134 Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek 
+Date: Wed, 18 Oct 2023 12:37:40 +0200
+Subject: [PATCH] tree-ssa-math-opts: Fix up match_uaddc_usubc [PR111845]
+
+GCC ICEs on the first testcase.  Successful match_uaddc_usubc ends up with
+some dead stmts which DCE will remove (hopefully) later all.
+The ICE is because one of the dead stmts refers to a freed SSA_NAME.
+The code already gsi_removes a couple of stmts in the
+  /* Remove some statements which can't be kept in the IL because they
+ use SSA_NAME whose setter is going to be removed too.  */
+section for the same reason (the reason for the freed SSA_NAMEs is that
+we don't really have a replacement for those cases - all we have after
+a match is combined overflow from the addition/subtraction of 2 operands + a
+[0, 1] carry in, but not the individual overflows from the former 2
+additions), but for the last (most significant) limb case, where we try
+to match x = op1 + op2 + carry1 + carry2; or
+x = op1 - op2 - carry1 - carry2; we just gsi_replace the final stmt, but
+left around the 2 temporary stmts as dead; if we were unlucky enough that
+those referenced the carry flag that went away, it ICEs.
+
+So, the following patch remembers those temporary statements (rather than
+trying to rediscover them more expensively) and removes them before the
+final one is replaced.
+
+While working on it, I've noticed we didn't support all the reassociated
+possibilities of writing the addition of 4 operands or subtracting 3
+operands from one, we supported e.g.
+x = ((op1 + op2) + op3) + op4;
+x = op1 + ((op2 + op3) + op4);
+but not
+x = (op1 + (op2 + op3)) + op4;
+x = op1 + (op2 + (op3 + op4));
+Fixed by the change to inspect also rhs[2] when rhs[1] didn't yield what
+we were searching for (if non-NULL) - rhs[0] is inspected in the first
+loop and has different handling for the MINUS_EXPR case.
+
+2023-10-18  Jakub Jelinek  
+
+   PR tree-optimization/111845
+   * tree-ssa-math-opts.cc (match_uaddc_usubc): Remember temporary
+   statements for the 4 operand addition or subtraction of 3 operands
+   from 1 operand cases and remove them when successful.  Look for
+   nested additions even from rhs[2], not just rhs[1].
+
+   * gcc.dg/pr111845.c: New test.
+   * gcc.target/i386/pr111845.c: New test.
+---
+ gcc/testsuite/gcc.dg/pr111845.c  | 16 
+ gcc/testsuite/gcc.target/i386/pr111845.c | 47 +++
+ gcc/tree-ssa-math-opts.cc| 48 +++-
+ 3 files changed, 94 insertions(+), 17 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/pr111845.c
+ create mode 100644 gcc/testsuite/gcc.target/i386/pr111845.c
+
+diff --git a/gcc/testsuite/gcc.dg/pr111845.c b/gcc/testsuite/gcc.dg/pr111845.c
+new file mode 100644
+index ..1bcb4f88e6f1
+--- /dev/null
 b/gcc/testsuite/gcc.dg/pr111845.c
+@@ -0,0 +1,16 @@
++/* PR tree-optimization/111845 */
++/* { dg-do compile } */
++/* { dg-options "-O2 --param tree-reassoc-width=2" } */
++
++int a, b;
++unsigned int c, d, e;
++
++void
++foo (int x)
++{
++  b += d;
++  c += b < d;
++  b += e = a < x;
++  c += b;
++  c += b < e;
++}
+diff --git a/gcc/testsuite/gcc.target/i386/pr111845.c 
b/gcc/testsuite/gcc.target/i386/pr111845.c
+new file mode 100644
+index ..d52110a40422
+--- /dev/null
 b/gcc/testsuite/gcc.target/i386/pr111845.c
+@@ -0,0 +1,47 @@
++/* PR tree-optimization/111845 */
++/* { dg-do compile } */
++/* { dg-options "-O2 -g -masm=att" } */
++/* { dg-final { scan-assembler-times "\tadcq\t" 8 { target lp64 } } } */
++/* { dg-final { scan-assembler-times "\tadcl\t" 8 { target ia32 } } } */
++
++unsigned long l, m;
++
++__attribute__((noipa)) void
++foo (unsigned long x, unsigned long y, unsigned long h, unsigned long i, int 
a, int b)
++{
++  unsigned long c, d;
++  unsigned long e = __builtin_add_overflow (x, y, );
++  unsigned long f = __builtin_add_overflow (c, a < b, );
++ 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/, profiles/

2023-08-07 Thread Sam James
commit: 5a9a0738452e4387901ed2897e3ebf2a3a551632
Author: Sam James  gentoo  org>
AuthorDate: Tue Aug  8 05:42:47 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Aug  8 05:42:58 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a9a0738

sys-devel/gcc: backport bootstrap fix for 14.0.0_pre20230806

Signed-off-by: Sam James  gentoo.org>

 profiles/package.mask  |   4 -
 .../gcc-14.0.0_pre20230806-fix-bootstrap.patch | 105 +
 ...806.ebuild => gcc-14.0.0_pre20230806-r1.ebuild} |   1 +
 3 files changed, 106 insertions(+), 4 deletions(-)

diff --git a/profiles/package.mask b/profiles/package.mask
index 35593ba85aa8..3935841819f6 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -33,10 +33,6 @@
 
 #--- END OF EXAMPLES ---
 
-# Sam James  (2023-07-07)
-# Fails to boostrap: https://gcc.gnu.org/PR110926
-=sys-devel/gcc-14.0.0_pre20230806
-
 # Volkmar W. Pogatzki  (2023-07-05)
 # Library without consumers. Bug #906882
 # Removal on 2023-08-05.

diff --git a/sys-devel/gcc/files/gcc-14.0.0_pre20230806-fix-bootstrap.patch 
b/sys-devel/gcc/files/gcc-14.0.0_pre20230806-fix-bootstrap.patch
new file mode 100644
index ..5d5747312b69
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-14.0.0_pre20230806-fix-bootstrap.patch
@@ -0,0 +1,105 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=af6cfd7b663909688c6ca55b6e9f859cdde4310f
+https://gcc.gnu.org/PR110926
+
+From af6cfd7b663909688c6ca55b6e9f859cdde4310f Mon Sep 17 00:00:00 2001
+From: liuhongt 
+Date: Mon, 7 Aug 2023 11:10:52 +0800
+Subject: [PATCH] Fix ICE in rtl check when bootstrap.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf8
+Content-Transfer-Encoding: 8bit
+
+/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/libgfortran/generated/matmul_i1.c:
 In function âmatmul_i1_avx512fâ:
+/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/libgfortran/generated/matmul_i1.c:1781:1:
 internal compiler error: RTL check: expected elt 0 type 'i' or 'n', have 'w' 
(rtx const_int) in vpternlog_redundant_operand_mask, at 
config/i386/i386.cc:19460
+ 1781 | }
+  | ^
+0x5559de26dc2d rtl_check_failed_type2(rtx_def const*, int, int, int, char 
const*, int, char const*)
+
/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/rtl.cc:761
+0x5559de340bfe vpternlog_redundant_operand_mask(rtx_def**)
+
/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/config/i386/i386.cc:19460
+0x5559dfec67a6 split_44
+
/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/config/i386/sse.md:12730
+0x5559dfec67a6 split_63
+
/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/config/i386/sse.md:28428
+0x5559deb8a682 try_split(rtx_def*, rtx_insn*, int)
+
/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/emit-rtl.cc:3800
+0x5559deb8adf2 try_split(rtx_def*, rtx_insn*, int)
+
/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/emit-rtl.cc:3972
+0x5559def69194 split_insn
+
/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/recog.cc:3385
+0x5559def70c57 split_all_insns()
+
/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/recog.cc:3489
+0x5559def70d0c execute
+
/var/tmp/portage/sys-devel/gcc-14.0.0_pre20230806/work/gcc-14-20230806/gcc/recog.cc:4413
+
+Use INTVAL (imm_op) instead of XINT (imm_op, 0).
+
+gcc/ChangeLog:
+
+   PR target/110926
+   * config/i386/i386-protos.h
+   (vpternlog_redundant_operand_mask): Adjust parameter type.
+   * config/i386/i386.cc (vpternlog_redundant_operand_mask): Use
+   INTVAL instead of XINT, also adjust parameter type from rtx*
+   to rtx since the function only needs operands[4] in vpternlog
+   pattern.
+   (substitute_vpternlog_operands): Pass operands[4] instead of
+   operands to vpternlog_redundant_operand_mask.
+   * config/i386/sse.md: Ditto.
+--- a/gcc/config/i386/i386-protos.h
 b/gcc/config/i386/i386-protos.h
+@@ -70,7 +70,7 @@ extern machine_mode ix86_cc_mode (enum rtx_code, rtx, rtx);
+ extern int avx_vpermilp_parallel (rtx par, machine_mode mode);
+ extern int avx_vperm2f128_parallel (rtx par, machine_mode mode);
+ 
+-extern int vpternlog_redundant_operand_mask (rtx[]);
++extern int vpternlog_redundant_operand_mask (rtx);
+ extern void substitute_vpternlog_operands (rtx[]);
+ 
+ extern bool ix86_expand_strlen (rtx, rtx, rtx, rtx);
+--- a/gcc/config/i386/i386.cc
 b/gcc/config/i386/i386.cc
+@@ -19454,10 +19454,10 @@ avx_vperm2f128_parallel (rtx par, machine_mode mode)
+ /* Return a mask of VPTERNLOG operands that do not affect output.  */
+ 
+ int
+-vpternlog_redundant_operand_mask (rtx *operands)
++vpternlog_redundant_operand_mask (rtx pternlog_imm)
+ {
+   int mask = 0;
+-  int imm8 = XINT 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2023-05-16 Thread Sam James
commit: 0290ec871c3c59716cdf7718bbee1cef1b86ec43
Author: Sam James  gentoo  org>
AuthorDate: Tue May 16 06:07:12 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Tue May 16 06:07:20 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0290ec87

sys-devel/gcc: backport ccache ICE fix for 12.3*

Bug: https://bugs.gentoo.org/906310
Signed-off-by: Sam James  gentoo.org>

 sys-devel/gcc/files/gcc-12.3-ccache-ICE.patch | 67 +++
 sys-devel/gcc/gcc-12.3.1_p20230512-r1.ebuild  | 57 +++
 2 files changed, 124 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-12.3-ccache-ICE.patch 
b/sys-devel/gcc/files/gcc-12.3-ccache-ICE.patch
new file mode 100644
index ..9a170f5db77e
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-12.3-ccache-ICE.patch
@@ -0,0 +1,67 @@
+https://bugs.gentoo.org/906310
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109850
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109241
+
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=396a4e76afec30d2461638f569cae18955eb4ad2
+
+From 396a4e76afec30d2461638f569cae18955eb4ad2 Mon Sep 17 00:00:00 2001
+From: Jason Merrill 
+Date: Wed, 22 Mar 2023 16:11:47 -0400
+Subject: [PATCH] c++: local class in nested generic lambda [PR109241]
+
+In this testcase, the tree walk to look for bare parameter packs was
+confused by finding a type with no TREE_BINFO.  But it should be fine that
+it's unset; we already checked for unexpanded packs at parse time.
+
+I also tried doing the partial instantiation of the local class, which is
+probably the long-term direction we want to go, but for stage 4 let's go
+with this safer change.
+
+   PR c++/109241
+
+gcc/cp/ChangeLog:
+
+   * pt.cc (find_parameter_packs_r): Handle null TREE_BINFO.
+
+gcc/testsuite/ChangeLog:
+
+   * g++.dg/cpp1y/lambda-generic-local-class2.C: New test.
+--- a/gcc/cp/pt.cc
 b/gcc/cp/pt.cc
+@@ -4106,10 +4106,14 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, 
void* data)
+ case TAG_DEFN:
+   t = TREE_TYPE (t);
+   if (CLASS_TYPE_P (t))
+-  /* Local class, need to look through the whole definition.  */
+-  for (tree bb : BINFO_BASE_BINFOS (TYPE_BINFO (t)))
+-cp_walk_tree (_TYPE (bb), _parameter_packs_r,
+-  ppd, ppd->visited);
++  {
++/* Local class, need to look through the whole definition.
++   TYPE_BINFO might be unset for a partial instantiation.  */
++if (TYPE_BINFO (t))
++  for (tree bb : BINFO_BASE_BINFOS (TYPE_BINFO (t)))
++cp_walk_tree (_TYPE (bb), _parameter_packs_r,
++  ppd, ppd->visited);
++  }
+   else
+   /* Enum, look at the values.  */
+   for (tree l = TYPE_VALUES (t); l; l = TREE_CHAIN (l))
+--- /dev/null
 b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-class2.C
+@@ -0,0 +1,13 @@
++// PR c++/109241
++// { dg-do compile { target c++14 } }
++// { dg-options "" } no pedantic
++
++void g() {
++  [](auto) {
++[](auto) {
++  ({
++struct A {};
++  });
++};
++  }(1);
++}
+-- 
+2.31.1

diff --git a/sys-devel/gcc/gcc-12.3.1_p20230512-r1.ebuild 
b/sys-devel/gcc/gcc-12.3.1_p20230512-r1.ebuild
new file mode 100644
index ..922e86050a50
--- /dev/null
+++ b/sys-devel/gcc/gcc-12.3.1_p20230512-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="2"
+PATCH_GCC_VER="12.3.0"
+MUSL_VER="1"
+MUSL_GCC_VER="12.3.0"
+
+if [[ $(ver_cut 3) ==  ]] ; then
+   MY_PV_2=$(ver_cut 2)
+   if [[ ${MY_PV_2} == 0 ]] ; then
+   MY_PV_2=0
+   else
+   MY_PV_2=$(($(ver_cut 2) - 1))
+   fi
+
+   # e.g. 12.2. -> 12.1.1
+   TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.$(($(ver_cut 3) - 9998))
+elif [[ -n ${TOOLCHAIN_GCC_RC} ]] ; then
+   # Cheesy hack for RCs
+   # Sometimes the RCs are e.g. 12.3 and not 12.3.0...
+   #MY_PV=$(ver_cut 1).$((($(ver_cut 2) + 1))).$((($(ver_cut 3) - 
1)))-RC-$(ver_cut 5)
+   MY_PV=$(ver_cut 1).$((($(ver_cut 2) + 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
+
+# Needs to be after inherit (for now?), bug #830908
+EGIT_BRANCH=releases/gcc-$(ver_cut 1)
+
+# 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"
+#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? ( 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2023-05-03 Thread Sam James
commit: 1e10614cf5b563340143230bae47c10c45300196
Author: Sam James  gentoo  org>
AuthorDate: Wed May  3 12:31:04 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Wed May  3 12:31:04 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e10614c

sys-devel/gcc: backport libstdc++ UB fix for 13

May keyword this version later or may wait until next snapshot in a few days,
we'll see.

Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109703
Signed-off-by: Sam James  gentoo.org>

 .../gcc/files/gcc-13-PR109703-unreachable.patch| 54 +++
 sys-devel/gcc/gcc-13.1.1_p20230429-r1.ebuild   | 63 ++
 2 files changed, 117 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13-PR109703-unreachable.patch 
b/sys-devel/gcc/files/gcc-13-PR109703-unreachable.patch
new file mode 100644
index ..f7c7c9f60a70
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13-PR109703-unreachable.patch
@@ -0,0 +1,54 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109703
+
+From d50f2599d7b23bdba05a9102645d082ed9bcb05f Mon Sep 17 00:00:00 2001
+From: Kefu Chai 
+Date: Mon, 1 May 2023 21:24:26 +0100
+Subject: [PATCH] libstdc++: Set _M_string_length before calling _M_dispose()
+ [PR109703]
+
+This always sets _M_string_length in the constructor for ranges of input
+iterators, such as stream iterators.
+
+We copy from the source range to the local buffer, and then repeatedly
+reallocate a larger one if necessary. When disposing the old buffer,
+_M_is_local() is used to tell if the buffer is the local one or not (and
+so must be deallocated). In addition to comparing the buffer address
+with the local buffer, _M_is_local() has an optimization hint so that
+the compiler knows that for a string using the local buffer, there is an
+invariant that _M_string_length <= _S_local_capacity (added for PR109299
+via r13-6915-gbf78b43873b0b7).  But we failed to set _M_string_length in
+the constructor taking a pair of iterators, so the invariant might not
+hold, and __builtin_unreachable() is reached. This causes UBsan errors,
+and potentially misoptimization.
+
+To ensure the invariant holds, _M_string_length is initialized to zero
+before doing anything else, so that _M_is_local() doesn't see an
+uninitialized value.
+
+This issue only surfaces when constructing a string with a range of
+input iterator, and the uninitialized _M_string_length happens to be
+greater than _S_local_capacity, i.e., 15 for the std::string
+specialization.
+
+libstdc++-v3/ChangeLog:
+
+   PR libstdc++/109703
+   * include/bits/basic_string.h (basic_string(Iter, Iter, Alloc)):
+   Initialize _M_string_length.
+
+Signed-off-by: Kefu Chai 
+Co-authored-by: Jonathan Wakely 
+(cherry picked from commit cbf6c7a1d16490a1e63e9a5ce00e9a5c44c4c2f2)
+--- a/libstdc++-v3/include/bits/basic_string.h
 b/libstdc++-v3/include/bits/basic_string.h
+@@ -760,7 +760,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
+   _GLIBCXX20_CONSTEXPR
+ basic_string(_InputIterator __beg, _InputIterator __end,
+const _Alloc& __a = _Alloc())
+-  : _M_dataplus(_M_local_data(), __a)
++  : _M_dataplus(_M_local_data(), __a), _M_string_length(0)
+   {
+ #if __cplusplus >= 201103L
+ _M_construct(__beg, __end, std::__iterator_category(__beg));
+-- 
+2.31.1

diff --git a/sys-devel/gcc/gcc-13.1.1_p20230429-r1.ebuild 
b/sys-devel/gcc/gcc-13.1.1_p20230429-r1.ebuild
new file mode 100644
index ..9aa2b8645de1
--- /dev/null
+++ b/sys-devel/gcc/gcc-13.1.1_p20230429-r1.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+TOOLCHAIN_PATCH_DEV="sam"
+PATCH_VER="2"
+PATCH_GCC_VER="13.2.0"
+MUSL_VER="1"
+MUSL_GCC_VER="13.2.0"
+
+if [[ $(ver_cut 3) ==  ]] ; then
+   MY_PV_2=$(ver_cut 2)
+   if [[ ${MY_PV_2} == 0 ]] ; then
+   MY_PV_2=0
+   else
+   MY_PV_2=$(($(ver_cut 2) - 1))
+   fi
+
+   # e.g. 12.2. -> 12.1.1
+   TOOLCHAIN_GCC_PV=$(ver_cut 1).${MY_PV_2}.$(($(ver_cut 3) - 9998))
+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
+
+# Needs to be after inherit (for now?), bug #830908
+EGIT_BRANCH=releases/gcc-$(ver_cut 1)
+
+# 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"
+#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 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2023-04-26 Thread Sam James
commit: 79519252e88f8ad8c8ddf627ff9a473e99222e7b
Author: Sam James  gentoo  org>
AuthorDate: Wed Apr 26 14:13:21 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Wed Apr 26 14:13:56 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79519252

sys-devel/gcc: fix 13 cross builds w/ fixincludes

Add workaround for now.

Bug: https://bugs.gentoo.org/905118
Signed-off-by: Sam James  gentoo.org>

 .../gcc/files/gcc-13-fix-cross-fixincludes.patch  | 19 +++
 sys-devel/gcc/gcc-13.1.0-r1.ebuild|  1 +
 2 files changed, 20 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch 
b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
new file mode 100644
index ..e4abe01a0830
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
@@ -0,0 +1,19 @@
+Revert of 
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=59e4c98173a79fcaa2c33253261409f38856c384
+for now to fix cross fixincludes builds.
+
+https://bugs.gentoo.org/905118
+--- a/gcc/Makefile.in
 b/gcc/Makefile.in
+@@ -532,11 +532,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
+ # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
+ NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
+ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
+-ifeq (@includedir@,$(prefix)/include)
+-  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+-else
+-  CROSS_SYSTEM_HEADER_DIR = @includedir@
+-endif
++CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+ 
+ # autoconf sets SYSTEM_HEADER_DIR to one of the above.
+ # Purge it of unnecessary internal relative paths

diff --git a/sys-devel/gcc/gcc-13.1.0-r1.ebuild 
b/sys-devel/gcc/gcc-13.1.0-r1.ebuild
index d55926f246f1..195b306ad1d2 100644
--- a/sys-devel/gcc/gcc-13.1.0-r1.ebuild
+++ b/sys-devel/gcc/gcc-13.1.0-r1.ebuild
@@ -57,5 +57,6 @@ src_prepare() {
 
toolchain_src_prepare
 
+   eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
eapply_user
 }



[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2023-04-17 Thread Sam James
commit: 57ab40882690719109d8ea0e989d6f0353472364
Author: Sam James  gentoo  org>
AuthorDate: Mon Apr 17 12:03:44 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Apr 17 12:03:48 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=57ab4088

sys-devel/gcc: drop old 13 snapshots

Signed-off-by: Sam James  gentoo.org>

 sys-devel/gcc/Manifest |  1 -
 ...gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch | 63 -
 ...-clang-LocalizationChecker-ranger-any-PHI.patch | 46 ---
 1_pre20230409-PR109469-SLP-returns-twice.patch | 66 --
 ...pre20230409-PR109473-ICE-reduction-epilog.patch | 58 ---
 sys-devel/gcc/gcc-13.0.1_pre20230409-r1.ebuild | 56 --
 sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild | 57 ---
 sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild | 58 ---
 sys-devel/gcc/gcc-13.0.1_pre20230409-r4.ebuild | 60 
 sys-devel/gcc/gcc-13.0.1_pre20230409.ebuild| 56 --
 10 files changed, 521 deletions(-)

diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index 3921631e9688..fdc8c8a0f9a1 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -27,7 +27,6 @@ DIST gcc-12.2.0-patches-10.tar.xz 14252 BLAKE2B 
99368db982227728a6a9e2b1f694999f
 DIST gcc-12.2.0-patches-13.tar.xz 13756 BLAKE2B 
df0388a669458f2991951d2f4027badbff3f802e6a0422478206b5cdda76e70b531a474d2ac42817e9e7f8200e9ac35ca8276af539839b4ebb2e22903ec25a23
 SHA512 
2970de9d2806d59c5d0f77e66000860c816ebd674489db8114f48f6aa11575644154431480222580b520b9e312647b06f94ab38959a49a8cda818158d6babf1d
 DIST gcc-12.2.0-patches-14.tar.xz 13752 BLAKE2B 
c44609a8a3a96480f144b7e6859c2b1d7105f421ffa08929c35fc13eb5ec11d967b02cf8248ecb4ea85824b1872125a73c92f404050c3399d5c06fe668711fd3
 SHA512 
c1db7a7f3a929dfdc8de9a662448f57296ab818b9fd133763b2ab0dddce2e01cf322e5ac53f3d69c2366053ef3c4fa44c72eed248dc7aeef49f558341bdd3854
 DIST gcc-12.2.0.tar.xz 84645292 BLAKE2B 
715574af9ad678f9dc8cfd19c866bf910c7edfd479e7e9681337feaa9b54e5d304ddb85483816b8d89754d502405823ae2eff0d1e444538763f40be8e428d8da
 SHA512 
e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173
-DIST gcc-13-20230409.tar.xz 83942252 BLAKE2B 
9fb394de80814c13f91ea1cc078e9ab5623576d67115f61b6090594d44ed9179445fe58fc35f509e9bfcc2c7305e8e111c24df4f2f62fe134eb24b09f7c15b7f
 SHA512 
6b2fb29abf0ed77dcccd393d8ec0b8abc2d7aada0de6bab20eb561fd3f738c4b5023fb5598ffb017d10f099d597ddbc324a6dc71d5ed0119a7d9a7ef1faec1a1
 DIST gcc-13-20230416.tar.xz 83936936 BLAKE2B 
c052fff2838a0bdd87f90345a5f7f5c607a6fe360b02ce8cb076f6dd3a62f6aae0c7d3914eee447e9c92c971331ddcbf0c94f2aa120aef89a742162b5e7dbfdd
 SHA512 
222bb6db05b23aeb428262c69319a4964097065a88a5ae6c19b104c31af82c465f139c08f01bb077b0e776685769b77a54b772ebc4e2057e7c3e8954283997cf
 DIST gcc-13.1.0-musl-patches-1.tar.xz 3528 BLAKE2B 
c572ab4a0fb929b16ec36b3a3616cdcccd62f7ee27ded8077008b9beb50539db64cc251ff8a3eade54e8ebfe1012f8f32d0802379bf8ffb0f1b8ce7c8457da37
 SHA512 
ffb7dfa54a9d23b5333664e915efd9f18a43cd696f4ff5669a8b072a0e9cf4978de53e315123542441a2533e4f269de0bb7d90ee7a37d3a7517b7cda6ea06681
 DIST gcc-13.1.0-patches-9.tar.xz 11720 BLAKE2B 
c26a2924fa8aab318a1f4a4974ca4aeba255f3605fa0cbf448a4e48b6f3e9359012aeae15726299059257b93043c5cdd86bf1b2f2fffd4b9a096ab411a0503ba
 SHA512 
98e48abaa664ea18bf00ba7bdb29cc1e908cc55ba9d12d52061e86fc917753ade8e38a190c04d23c63102808ac5a9e8ecf085dcc29a1568a329ceb5d43cf0290

diff --git 
a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch 
b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch
deleted file mode 100644
index 5d45d8f4e018..
--- a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6e3e708dbadaae7b504af7fc4410015624793f02
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109434
-
-From 6e3e708dbadaae7b504af7fc4410015624793f02 Mon Sep 17 00:00:00 2001
-From: Richard Biener 
-Date: Tue, 11 Apr 2023 15:06:59 +0200
-Subject: [PATCH] tree-optimization/109434 - bogus DSE of throwing call LHS
-
-The byte tracking of call LHS didn't properly handle possibly
-throwing calls correctly which cases bogus DSE and in turn, for the
-testcase a bogus uninit diagnostic and (unreliable) wrong-code.
-
-   PR tree-optimization/109434
-   * tree-ssa-dse.cc (initialize_ao_ref_for_dse): Properly
-   handle possibly throwing calls when processing the LHS
-   and may-defs are not OK.
-
-   * g++.dg/opt/pr109434.C: New testcase.
 /dev/null
-+++ b/gcc/testsuite/g++.dg/opt/pr109434.C
-@@ -0,0 +1,28 @@
-+// { dg-do compile }
-+// { dg-require-effective-target c++17 }
-+// { dg-options "-O2 -Wall" }
-+
-+#include 
-+#include 
-+
-+std::optional foo()
-+{
-+  volatile int x = 1;
-+  if (x)

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2023-04-12 Thread Sam James
commit: efd15a6fa5db222c80ae272f77ae229340e4fb20
Author: Sam James  gentoo  org>
AuthorDate: Wed Apr 12 13:20:36 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Wed Apr 12 13:23:23 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=efd15a6f

sys-devel/gcc: backport two more patches for 13 (checking ICE + Clang 
miscompilation)

First fix is a checking ICE. As we're new to handling checking (see previous 
commits),
these are generally a sign of possible wrong-code/miscompilation, so it's nice
when checking flags it up and turns the issue into an ICE. So, don't be fooled
by the ICE part.

Second is a miscompilation of Clang which leads to a test failure.

I wouldn't normally backport so many of these, but they're all things we've
found through testing in Gentoo over the last few days, and it's especially
important given GCC 13 is imminent.

Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109473
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109462
Signed-off-by: Sam James  gentoo.org>

 ...-clang-LocalizationChecker-ranger-any-PHI.patch | 46 +
 ...pre20230409-PR109473-ICE-reduction-epilog.patch | 58 +
 sys-devel/gcc/gcc-13.0.1_pre20230409-r4.ebuild | 60 ++
 3 files changed, 164 insertions(+)

diff --git 
a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109462-clang-LocalizationChecker-ranger-any-PHI.patch
 
b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109462-clang-LocalizationChecker-ranger-any-PHI.patch
new file mode 100644
index ..2b5ea5ad826a
--- /dev/null
+++ 
b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109462-clang-LocalizationChecker-ranger-any-PHI.patch
@@ -0,0 +1,46 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109462
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=24af552876eff707f75d30d3f0f0e7a5d62dd857
+
+From 24af552876eff707f75d30d3f0f0e7a5d62dd857 Mon Sep 17 00:00:00 2001
+From: Andrew MacLeod 
+Date: Tue, 11 Apr 2023 17:29:03 -0400
+Subject: [PATCH] Don't use ANY PHI equivalences in range-on-entry.
+
+PR 108139 dissallows PHI equivalencies in the on-entry calculator, but
+it was only checking if the equivlaence was a PHI.  In this case, NAME
+itself is a PHI with an equivlaence caused by an undefined value, so we
+also need to check that case.  Unfortunately this un-fixes 101912.
+
+   PR tree-optimization/109462
+   gcc/
+   * gimple-range-cache.cc (ranger_cache::fill_block_cache): Don't
+   check for equivalences if NAME is a phi node.
+
+   gcc/testsuite/
+   * gcc.dg/uninit-pr101912.c: XFAIL the warning.
+--- a/gcc/gimple-range-cache.cc
 b/gcc/gimple-range-cache.cc
+@@ -1218,7 +1218,9 @@ ranger_cache::fill_block_cache (tree name, basic_block 
bb, basic_block def_bb)
+ fprintf (dump_file, "\n");
+   }
+   // See if any equivalences can refine it.
+-  if (m_oracle)
++  // PR 109462, like 108139 below, a one way equivalence introduced
++  // by a PHI node can also be through the definition side.  Disallow it.
++  if (m_oracle && !is_a (SSA_NAME_DEF_STMT (name)))
+   {
+ tree equiv_name;
+ relation_kind rel;
+--- a/gcc/testsuite/gcc.dg/uninit-pr101912.c
 b/gcc/testsuite/gcc.dg/uninit-pr101912.c
+@@ -11,7 +11,7 @@ tzloadbody (void)
+   for (int i = 0; i < n; i++)
+ {
+   int corr = getint ();
+-  if (corr < 1 || (corr == 1 && !(leapcnt == 0 || (prevcorr < corr ? corr 
== prevcorr + 1 : (corr == prevcorr || corr == prevcorr - 1) /* { dg-bogus 
"uninitialized" } */
++  if (corr < 1 || (corr == 1 && !(leapcnt == 0 || (prevcorr < corr ? corr 
== prevcorr + 1 : (corr == prevcorr || corr == prevcorr - 1) /* { dg-bogus 
"uninitialized" "pr101912" { xfail *-*-* } } */
+   return -1;
+ 
+   prevcorr = corr;
+-- 
+2.31.1

diff --git 
a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109473-ICE-reduction-epilog.patch
 
b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109473-ICE-reduction-epilog.patch
new file mode 100644
index ..cab26653a09d
--- /dev/null
+++ 
b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109473-ICE-reduction-epilog.patch
@@ -0,0 +1,58 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=df7f55cb2ae550adeda339a57b657ebe1ad39367
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109473
+
+From df7f55cb2ae550adeda339a57b657ebe1ad39367 Mon Sep 17 00:00:00 2001
+From: Richard Biener 
+Date: Wed, 12 Apr 2023 10:22:08 +0200
+Subject: [PATCH] tree-optimization/109473 - ICE with reduction epilog
+ adjustment op
+
+The following makes sure to carry out the reduction epilog adjustment
+in the original computation type which for pointers is an unsigned
+integer type.  There's a similar issue with signed vs. unsigned ops
+and overflow which is fixed by this as well.
+
+   PR tree-optimization/109473
+   * tree-vect-loop.cc (vect_create_epilog_for_reduction):
+   Convert scalar result to the computation type before performing
+   the 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2023-04-12 Thread Sam James
commit: e753e969fe0d9dffb1a68e4358821cddbf11bca6
Author: Sam James  gentoo  org>
AuthorDate: Wed Apr 12 07:38:52 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Wed Apr 12 07:39:20 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e753e969

sys-devel/gcc: backport DSE fix for std::optional for 13

Probably wouldn't do this by itself but given I've just pushed the
SLP fix (989bee28461116343b958e978fe19472fe2ea3cb) and nobody will have built
that yet, let's just do it given it's a miscompilation.

Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109434
Signed-off-by: Sam James  gentoo.org>

 ...gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch | 63 ++
 sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild | 58 
 2 files changed, 121 insertions(+)

diff --git 
a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch 
b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch
new file mode 100644
index ..5d45d8f4e018
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109434-DSE-throw.patch
@@ -0,0 +1,63 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6e3e708dbadaae7b504af7fc4410015624793f02
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109434
+
+From 6e3e708dbadaae7b504af7fc4410015624793f02 Mon Sep 17 00:00:00 2001
+From: Richard Biener 
+Date: Tue, 11 Apr 2023 15:06:59 +0200
+Subject: [PATCH] tree-optimization/109434 - bogus DSE of throwing call LHS
+
+The byte tracking of call LHS didn't properly handle possibly
+throwing calls correctly which cases bogus DSE and in turn, for the
+testcase a bogus uninit diagnostic and (unreliable) wrong-code.
+
+   PR tree-optimization/109434
+   * tree-ssa-dse.cc (initialize_ao_ref_for_dse): Properly
+   handle possibly throwing calls when processing the LHS
+   and may-defs are not OK.
+
+   * g++.dg/opt/pr109434.C: New testcase.
+--- /dev/null
 b/gcc/testsuite/g++.dg/opt/pr109434.C
+@@ -0,0 +1,28 @@
++// { dg-do compile }
++// { dg-require-effective-target c++17 }
++// { dg-options "-O2 -Wall" }
++
++#include 
++#include 
++
++std::optional foo()
++{
++  volatile int x = 1;
++  if (x)
++throw std::runtime_error("haha");
++  return 42;
++}
++
++int main()
++{
++  std::optional optInt;
++  try {
++  // We falsely DSEd the LHS of the call even though foo throws
++  // which results in an uninitialized diagnostic
++  optInt = foo();
++  } catch (...) {
++  return optInt.has_value();
++  }
++  std::optional optDbl{optInt};
++  return optDbl ? optDbl.value () : 2.0;
++}
+--- a/gcc/tree-ssa-dse.cc
 b/gcc/tree-ssa-dse.cc
+@@ -179,7 +179,8 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write, 
bool may_def_ok = false)
+ }
+   if (tree lhs = gimple_get_lhs (stmt))
+ {
+-  if (TREE_CODE (lhs) != SSA_NAME)
++  if (TREE_CODE (lhs) != SSA_NAME
++&& (may_def_ok || !stmt_could_throw_p (cfun, stmt)))
+   {
+ ao_ref_init (write, lhs);
+ return true;
+-- 
+2.31.1

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild 
b/sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild
new file mode 100644
index ..073f68b644ac
--- /dev/null
+++ b/sys-devel/gcc/gcc-13.0.1_pre20230409-r3.ebuild
@@ -0,0 +1,58 @@
+# 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) ==  ]] ; 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. -> 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}-PR109469-SLP-returns-twice.patch
+   eapply 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2023-04-12 Thread Sam James
commit: 989bee28461116343b958e978fe19472fe2ea3cb
Author: Sam James  gentoo  org>
AuthorDate: Wed Apr 12 07:20:32 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Wed Apr 12 07:35:03 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=989bee28

sys-devel/gcc: fix SLP returns_twice issue for 13

This fixes a checking (which we now do by default for pre-releases) ICE
for busybox/xdvik, but it's potentially more serious anyway.

Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109469
Signed-off-by: Sam James  gentoo.org>

 1_pre20230409-PR109469-SLP-returns-twice.patch | 66 ++
 sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild | 57 +++
 2 files changed, 123 insertions(+)

diff --git 
a/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109469-SLP-returns-twice.patch 
b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109469-SLP-returns-twice.patch
new file mode 100644
index ..7d45c9e60af8
--- /dev/null
+++ 
b/sys-devel/gcc/files/gcc-13.0.1_pre20230409-PR109469-SLP-returns-twice.patch
@@ -0,0 +1,66 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109469
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=2d7ad38707e1fd71193d440198cc0726092b9015
+
+From 2d7ad38707e1fd71193d440198cc0726092b9015 Mon Sep 17 00:00:00 2001
+From: Richard Biener 
+Date: Tue, 11 Apr 2023 16:06:12 +0200
+Subject: [PATCH] tree-optimization/109469 - SLP with returns-twice region
+ start
+
+The following avoids an SLP region starting with a returns-twice
+call where we cannot insert stmts at the head.
+
+   PR tree-optimization/109469
+   * tree-vect-slp.cc (vect_slp_function): Skip region starts with
+   a returns-twice call.
+
+   * gcc.dg/torture/pr109469.c: New testcase.
+--- /dev/null
 b/gcc/testsuite/gcc.dg/torture/pr109469.c
+@@ -0,0 +1,15 @@
++/* { dg-do compile } */
++
++__attribute__((returns_twice)) int foo();
++
++struct xio myproc;
++struct xio {
++  void (*read_proc)();
++  void (*write_proc)();
++};
++
++void dummy_write_proc() {
++  switch (foo())
++  default:
++myproc.read_proc = myproc.write_proc = dummy_write_proc;
++}
+--- a/gcc/tree-vect-slp.cc
 b/gcc/tree-vect-slp.cc
+@@ -7671,10 +7671,23 @@ vect_slp_function (function *fun)
+   {
+ r |= vect_slp_bbs (bbs, NULL);
+ bbs.truncate (0);
+-bbs.quick_push (bb);
+   }
+-  else
+-  bbs.safe_push (bb);
++
++  /* We need to be able to insert at the head of the region which
++   we cannot for region starting with a returns-twice call.  */
++  if (bbs.is_empty ())
++  if (gcall *first = safe_dyn_cast  (first_stmt (bb)))
++if (gimple_call_flags (first) & ECF_RETURNS_TWICE)
++  {
++if (dump_enabled_p ())
++  dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
++   "skipping bb%d as start of region as it "
++   "starts with returns-twice call\n",
++   bb->index);
++continue;
++  }
++
++  bbs.safe_push (bb);
+ 
+   /* When we have a stmt ending this block and defining a
+value we have to insert on edges when inserting after it for
+-- 
+2.31.1

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild 
b/sys-devel/gcc/gcc-13.0.1_pre20230409-r2.ebuild
new file mode 100644
index ..527b71d68608
--- /dev/null
+++ b/sys-devel/gcc/gcc-13.0.1_pre20230409-r2.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) ==  ]] ; 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. -> 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 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2023-04-04 Thread Sam James
commit: f5200bf6e1bf373bc4a04128746ad64ca29d2626
Author: Sam James  gentoo  org>
AuthorDate: Wed Apr  5 01:10:58 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Wed Apr  5 01:10:58 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f5200bf6

sys-devel/gcc: backport 13 fix for Python 3.12 ICE

Closes: https://bugs.gentoo.org/903245
Signed-off-by: Sam James  gentoo.org>

 ...3.0.1_pre20230402-PR109304-ICE-python3.12.patch | 72 ++
 sys-devel/gcc/gcc-13.0.1_pre20230402-r1.ebuild | 57 +
 2 files changed, 129 insertions(+)

diff --git 
a/sys-devel/gcc/files/gcc-13.0.1_pre20230402-PR109304-ICE-python3.12.patch 
b/sys-devel/gcc/files/gcc-13.0.1_pre20230402-PR109304-ICE-python3.12.patch
new file mode 100644
index ..8b6baea37b70
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13.0.1_pre20230402-PR109304-ICE-python3.12.patch
@@ -0,0 +1,72 @@
+https://bugs.gentoo.org/903245
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109304
+https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=d0b961b802dd7d9d555ff4515835a479329326e9
+
+From d0b961b802dd7d9d555ff4515835a479329326e9 Mon Sep 17 00:00:00 2001
+From: Richard Biener 
+Date: Tue, 28 Mar 2023 08:06:12 +
+Subject: [PATCH] tree-optimization/109304 - properly handle instrumented
+ aliases
+
+When adjusting calls to reflect instrumentation we failed to handle
+calls to aliases since they appear to have no body.  Instead resort
+to symtab node availability.  The patch also avoids touching
+internal function calls in a more obvious way (builtins might
+have a body available).
+
+profiledbootstrap & regtest running on x86_64-unknown-linux-gnu.
+
+Honza - does this look OK?
+
+   PR tree-optimization/109304
+   * tree-profile.cc (tree_profiling): Use symtab node
+   availability to decide whether to skip adjusting calls.
+   Do not adjust calls to internal functions.
+
+   * gcc.dg/pr109304.c: New testcase.
+--- /dev/null
 b/gcc/testsuite/gcc.dg/pr109304.c
+@@ -0,0 +1,12 @@
++/* { dg-do compile } */
++/* { dg-require-profiling "-fprofile-generate" } */
++/* { dg-require-effective-target fpic } */
++/* { dg-options "-O3 -fprofile-generate -fPIC -fno-semantic-interposition" } 
*/
++
++int PyUnicode_FindChar_i;
++int PyUnicode_FindChar()
++{
++  while (PyUnicode_FindChar_i)
++if (PyUnicode_FindChar())
++  break;
++}
+--- a/gcc/tree-profile.cc
 b/gcc/tree-profile.cc
+@@ -808,7 +808,7 @@ tree_profiling (void)
+   {
+   if (!gimple_has_body_p (node->decl)
+   || !(!node->clone_of
+-  || node->decl != node->clone_of->decl))
++   || node->decl != node->clone_of->decl))
+ continue;
+ 
+   /* Don't profile functions produced for builtin stuff.  */
+@@ -842,12 +842,15 @@ tree_profiling (void)
+   for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next ())
+ {
+   gcall *call = dyn_cast  (gsi_stmt (gsi));
+-  if (!call)
++  if (!call || gimple_call_internal_p (call))
+ continue;
+ 
+   /* We do not clear pure/const on decls without body.  */
+   tree fndecl = gimple_call_fndecl (call);
+-  if (fndecl && !gimple_has_body_p (fndecl))
++  cgraph_node *callee;
++  if (fndecl
++  && (callee = cgraph_node::get (fndecl))
++  && callee->get_availability (node) == AVAIL_NOT_AVAILABLE)
+ continue;
+ 
+   /* Drop the const attribute from the call type (the pure
+-- 
+2.31.1

diff --git a/sys-devel/gcc/gcc-13.0.1_pre20230402-r1.ebuild 
b/sys-devel/gcc/gcc-13.0.1_pre20230402-r1.ebuild
new file mode 100644
index ..004f9937b489
--- /dev/null
+++ b/sys-devel/gcc/gcc-13.0.1_pre20230402-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) ==  ]] ; 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. -> 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 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2022-08-21 Thread Sam James
commit: 49c1f635b4bb5b309af50879719dde4b5c5170c3
Author: Sam James  gentoo  org>
AuthorDate: Mon Aug 22 01:19:07 2022 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Aug 22 01:27:24 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49c1f635

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

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

 sys-devel/gcc/Manifest  |  4 +--
 sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch | 41 -
 sys-devel/gcc/gcc-11.3.0.ebuild | 10 ++
 3 files changed, 4 insertions(+), 51 deletions(-)

diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index c35c999ace2b..db2cddc22cbd 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -11,8 +11,8 @@ DIST gcc-10.4.0-patches-2.tar.xz 15000 BLAKE2B 
59a61f7de4b6d2338a8b4fbc88a8e5583
 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
-DIST gcc-11.3.0-musl-patches-1.tar.bz2 3997 BLAKE2B 
5ca064cc78b067f4a7822fa0341c37ae03c8024f871d2e274e481a583afa96c36e291be93fbdd633f203260ae2ea9ac1d45f666d134bac75bc9a715a369d7374
 SHA512 
0ab239c66cf62a737266377c19b8dda6af6df56380f6731c2c17f3e82778e7e023a68d31728490eea3ad946f4b71d4cab363a75548f74b4b7f653972469d9e91
-DIST gcc-11.3.0-patches-5.tar.bz2 14575 BLAKE2B 
55ff9558f3ffe89d511663f12477e72ed1bc29d4fa8f1bc58b9c52d28838716ba9b8291ede7b86e28c3bee0633c34763f611779fe46531bd75d8aa7661b46118
 SHA512 
65bf4c0d1d43923298efd527a5f4da2a10d88a383d2eef72e6a25ce37964ddaf27c49545915228347e8320f905afcdfe1275d98e8458993a7229425f74ae41bd
+DIST gcc-11.3.0-musl-patches-1.tar.xz 3768 BLAKE2B 
c591bc66f9d2e97d1b2450001dda15e9fc5b9b933cb52661815dd4a12db7973adb8d05b42a9c90badc29f06be690d98fc7fdeb3f3177497241560ed1211835ab
 SHA512 
ca7b1e2351b2b6b4dbc19a04ca79e37d229498b3e61715e9c72abc83357dce056b37c4a31fe92497a37eb4ffbfebf13d38c2cfda81b97c1b825f99a692cd6d31
+DIST gcc-11.3.0-patches-6.tar.xz 14776 BLAKE2B 
de0699621f366cb2569df22a54e8b758deaddb784162d2ba4070c9b25d1ffa4b2d3b8671c16424afa027384be18bacb8d96293feb32e0b90292c5d84aa35842b
 SHA512 
a4856307a4d21030c0fe5d13f7c05b32597ba949a84ecb20f7453392cbe1557231a88cd5fa1bffdc815a06ad3b139f2e13503872d4655de23dbe14465e525d54
 DIST gcc-11.3.0.tar.xz 81141364 BLAKE2B 
7e562d25446ca4ab9fe8cdb714866f66aba3744d78bf84f31bfb097c1a981e4c7f990cb1e6bcfec5ae6671836a4984e2b70eb8fed81dcef5e244f88da8623469
 SHA512 
f0be5ad705c73b84477128a69c047f57dd47002f375eb60e1e842e08cf2009a509e92152bca345823926d550b7395ae6d4de7db51d1ee371c2dc37313881fca7
 DIST gcc-11.4.0-musl-patches-0.tar.xz 3844 BLAKE2B 
f3f1be6718e3cf08e553a1a2319a85e13368279849f6f3ab89ad7abe505316afacf5084846c0cb133bdcb5c918244644242c194e6ce55455a26e67b3983d73ef
 SHA512 
a81db52d21de364137461dcff7e1af696df4a02fa26452f90439ae4af14ccbffe68eb4ee93ae56257490ab8aa36b4bff37c4e1f2cf4dd4624b3a6fb4cb50b7ac
 DIST gcc-11.4.0-patches-1.tar.xz 13956 BLAKE2B 
ff6ee1b81ad214e74a49c00b15767086c6b12b1566b42c4fb88778bfae3a8e319e42ffbcd8aa7f717b6f32bd966dc0da08be3a57a27992d9b90368622e7e2ff0
 SHA512 
3b9b641bb00b85fa88c87d8923ebcfb844125ff6149b998c565006173f4d68b0ccf8c1fec2c7bac0684584c61176346cee7373b165587a092bcd92ccb96c61db

diff --git a/sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch 
b/sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch
deleted file mode 100644
index 7907223248ae..
--- a/sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d2356ebb0084a0d80dbfe33040c9afe938c15d19
-https://bugs.gentoo.org/864717
-
-Fix build w/ glibc 2.36.
-
-From d2356ebb0084a0d80dbfe33040c9afe938c15d19 Mon Sep 17 00:00:00 2001
-From: Martin Liska 
-Date: Mon, 11 Jul 2022 22:03:14 +0200
-Subject: [PATCH] libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream
-
-9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 [sanitizer] Remove #include 
 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
-+++ 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2022-08-19 Thread Sam James
commit: 42d84bf32472b4cc0d16e81e4ef62e3d3f2fd3a9
Author: Sam James  gentoo  org>
AuthorDate: Fri Aug 19 17:57:53 2022 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Aug 19 18:05:18 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42d84bf3

sys-devel/gcc: add glibc 2.36 patch for 11.3.0, 10.4.0

Tried adding to gcc-patches (and indeed did) [0] but got into
a mess and it's not worth the hassle for now.

[0] 
https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=97ae6391c543891918047f724b0bddecc5f834bc
Closes: https://bugs.gentoo.org/864717
Signed-off-by: Sam James  gentoo.org>

 sys-devel/gcc/files/gcc-10.4.0-glibc-2.36.patch | 39 +++
 sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch | 41 +
 sys-devel/gcc/gcc-10.4.0.ebuild |  2 ++
 sys-devel/gcc/gcc-11.3.0.ebuild |  1 +
 4 files changed, 83 insertions(+)

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
new file mode 100644
index ..e773071188b7
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-10.4.0-glibc-2.36.patch
@@ -0,0 +1,39 @@
+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 
+Date: Mon, 11 Jul 2022 22:03:14 +0200
+Subject: [PATCH] libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream
+
+9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 [sanitizer] Remove #include 
 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 
+ #include 
+ #include 
++#if SANITIZER_ANDROID
+ #include 
++#endif
+ #include 
+ #include 
+ #include 
+@@ -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/files/gcc-11.3.0-glibc-2.36.patch 
b/sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch
new file mode 100644
index ..7907223248ae
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-11.3.0-glibc-2.36.patch
@@ -0,0 +1,41 @@
+https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d2356ebb0084a0d80dbfe33040c9afe938c15d19
+https://bugs.gentoo.org/864717
+
+Fix build w/ glibc 2.36.
+
+From d2356ebb0084a0d80dbfe33040c9afe938c15d19 Mon Sep 17 00:00:00 2001
+From: Martin Liska 
+Date: Mon, 11 Jul 2022 22:03:14 +0200
+Subject: [PATCH] libsanitizer: cherry-pick 9cf13067cb5088626ba7 from upstream
+
+9cf13067cb5088626ba7ee1ec4c42ec59c7995a0 [sanitizer] Remove #include 
 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 
+ #include 
+ #include 
++#if SANITIZER_ANDROID
+ #include 
++#endif
+ #include 
+ #include 
+ #include 
+@@ -828,10 +830,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 31a46b613160..311d04b1e636 100644
--- a/sys-devel/gcc/gcc-10.4.0.ebuild
+++ b/sys-devel/gcc/gcc-10.4.0.ebuild
@@ -43,6 +43,8 @@ RDEPEND=""
 BDEPEND="${CATEGORY}/binutils"
 
 src_prepare() {
+   eapply "${FILESDIR}"/${P}-glibc-2.36.patch
+
   

[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2021-11-17 Thread Sam James
commit: 192068fcd5aa14c681bcd90fe28f4bff641599e1
Author: Sam James  gentoo  org>
AuthorDate: Thu Nov 18 05:22:50 2021 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Nov 18 05:22:50 2021 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=192068fc

sys-devel/gcc: add workaround for cross-compile failure

Bug: https://bugs.gentoo.org/803371
Signed-off-by: Sam James  gentoo.org>

 .../files/gcc-11.2.0-cross-compile-include.patch   | 26 ++
 sys-devel/gcc/gcc-11.2.0.ebuild|  9 
 2 files changed, 35 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-11.2.0-cross-compile-include.patch 
b/sys-devel/gcc/files/gcc-11.2.0-cross-compile-include.patch
new file mode 100644
index ..d06410650bb0
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-11.2.0-cross-compile-include.patch
@@ -0,0 +1,26 @@
+https://bugs.gentoo.org/803371
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80196
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017
+--- a/configure
 b/configure
+@@ -17044,7 +17044,7 @@ else
+ fi
+
+
+-RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
++RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET -nostdinc++"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target 
ar" >&5
+ $as_echo_n "checking where to find the target ar... " >&6; }
+--- a/configure.ac
 b/configure.ac
+@@ -3529,7 +3529,7 @@ ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
+ ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
+ ACX_CHECK_INSTALLED_TARGET_TOOL(WINDMC_FOR_TARGET, windmc)
+
+-RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
++RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET -nostdinc++"
+
+ GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
+ GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
+

diff --git a/sys-devel/gcc/gcc-11.2.0.ebuild b/sys-devel/gcc/gcc-11.2.0.ebuild
index 193f8b813ec4..728de92f4777 100644
--- a/sys-devel/gcc/gcc-11.2.0.ebuild
+++ b/sys-devel/gcc/gcc-11.2.0.ebuild
@@ -11,3 +11,12 @@ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc 
ppc64 ~riscv ~s390
 
 RDEPEND=""
 BDEPEND="${CATEGORY}/binutils"
+
+src_prepare() {
+   toolchain_src_prepare
+
+   if is_crosscompile ; then
+   # bug #803371
+   eapply "${FILESDIR}"/gcc-11.2.0-cross-compile-include.patch
+   fi
+}



[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2020-02-06 Thread Sergei Trofimovich
commit: 066e26c95928de295cf822034de2d2cd05acf8af
Author: Sergei Trofimovich  gentoo  org>
AuthorDate: Thu Feb  6 19:19:13 2020 +
Commit: Sergei Trofimovich  gentoo  org>
CommitDate: Thu Feb  6 19:19:30 2020 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=066e26c9

sys-devel/gcc: allow negative insn cost, bug #707958

Apply the patch right on stable ebuild to unblock catalyst builds for ia64.

Reported-by: Matt Turner
Bug: https://bugs.gentoo.org/707958
Package-Manager: Portage-2.3.87, Repoman-2.3.20
Signed-off-by: Sergei Trofimovich  gentoo.org>

 sys-devel/gcc/files/gcc-9.2.0-neg-insn-cost.patch | 29 +++
 sys-devel/gcc/gcc-9.2.0-r2.ebuild |  7 +-
 sys-devel/gcc/gcc-9.2.0-r3.ebuild |  9 ++-
 3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/sys-devel/gcc/files/gcc-9.2.0-neg-insn-cost.patch 
b/sys-devel/gcc/files/gcc-9.2.0-neg-insn-cost.patch
new file mode 100644
index 000..7a6bebdf490
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-9.2.0-neg-insn-cost.patch
@@ -0,0 +1,29 @@
+https://bugs.gentoo.org/707958
+https://gcc.gnu.org/PR88879
+
+Subject: [PATCH] sel-sched: allow negative insn priority (PR 88879)
+From: Alexander Monakov 
+
+   PR rtl-optimization/88879
+   * sel-sched.c (sel_target_adjust_priority): Remove assert.
+
+From-SVN: r271039
+---
+ gcc/ChangeLog   | 5 +
+ gcc/sel-sched.c | 2 --
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+--- a/gcc/sel-sched.c
 b/gcc/sel-sched.c
+@@ -3331,8 +3331,6 @@ sel_target_adjust_priority (expr_t expr)
+   else
+ new_priority = priority;
+ 
+-  gcc_assert (new_priority >= 0);
+-
+   /* If the priority has changed, adjust EXPR_PRIORITY_ADJ accordingly.  */
+   EXPR_PRIORITY_ADJ (expr) = new_priority - EXPR_PRIORITY (expr);
+ 
+-- 
+2.25.0
+

diff --git a/sys-devel/gcc/gcc-9.2.0-r2.ebuild 
b/sys-devel/gcc/gcc-9.2.0-r2.ebuild
index e2638f44d60..97327a27655 100644
--- a/sys-devel/gcc/gcc-9.2.0-r2.ebuild
+++ b/sys-devel/gcc/gcc-9.2.0-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="7"
@@ -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}"/${PN}-9.2.0-neg-insn-cost.patch
+}

diff --git a/sys-devel/gcc/gcc-9.2.0-r3.ebuild 
b/sys-devel/gcc/gcc-9.2.0-r3.ebuild
index 107ecc45981..398613c13be 100644
--- a/sys-devel/gcc/gcc-9.2.0-r3.ebuild
+++ b/sys-devel/gcc/gcc-9.2.0-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="7"
@@ -14,6 +14,13 @@ DEPEND="${RDEPEND}
elibc_glibc? ( >=sys-libs/glibc-2.13 )
>=${CATEGORY}/binutils-2.20"
 
+PATCHES=("${FILESDIR}"/${PN}-9.2.0-neg-insn-cost.patch)
+
 if [[ ${CATEGORY} != cross-* ]] ; then
PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.13 )"
 fi
+
+src_prepare() {
+   toolchain_src_prepare
+   eapply "${FILESDIR}"/${PN}-9.2.0-neg-insn-cost.patch
+}



[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2019-05-03 Thread Andreas K. Hüttel
commit: 1331a15b06447dda35cf2b71f557c413d0209eb5
Author: Andreas K. Hüttel  gentoo  org>
AuthorDate: Wed May  1 22:12:37 2019 +
Commit: Andreas K. Hüttel  gentoo  org>
CommitDate: Fri May  3 21:43:57 2019 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1331a15b

sys-devel/gcc: Dont build 32bit ABIs on riscv, not supported by glibc

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

 sys-devel/gcc/files/gcc-8.3.0-norisc32.patch | 27 +++
 sys-devel/gcc/gcc-8.3.0-r1.ebuild|  3 ++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/sys-devel/gcc/files/gcc-8.3.0-norisc32.patch 
b/sys-devel/gcc/files/gcc-8.3.0-norisc32.patch
new file mode 100644
index 000..9315dc44893
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-8.3.0-norisc32.patch
@@ -0,0 +1,27 @@
+diff -ruN gcc-8.3.0.orig/gcc/config/riscv/t-linux-multilib 
gcc-8.3.0/gcc/config/riscv/t-linux-multilib
+--- gcc-8.3.0.orig/gcc/config/riscv/t-linux-multilib   2017-02-06 
22:38:37.0 +0100
 gcc-8.3.0/gcc/config/riscv/t-linux-multilib2019-04-28 
16:37:44.377841943 +0200
+@@ -20,21 +20,9 @@
+ ilp32d \
+ 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-8.3.0-r1.ebuild 
b/sys-devel/gcc/gcc-8.3.0-r1.ebuild
index 4ccee806e93..26b05fa3555 100644
--- a/sys-devel/gcc/gcc-8.3.0-r1.ebuild
+++ b/sys-devel/gcc/gcc-8.3.0-r1.ebuild
@@ -7,7 +7,7 @@ PATCH_VER="1.1"
 
 inherit toolchain
 
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv 
~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
 
 RDEPEND=""
 DEPEND="${RDEPEND}
@@ -21,4 +21,5 @@ fi
 src_prepare() {
toolchain_src_prepare
eapply "${FILESDIR}"/gcc-8.3.0-ia64-bootstrap.patch
+   eapply "${FILESDIR}"/gcc-8.3.0-norisc32.patch
 }



[gentoo-commits] repo/gentoo:master commit in: sys-devel/gcc/, sys-devel/gcc/files/

2017-11-19 Thread Andreas Hüttel
commit: 5075159e68f93318fac08601d175c7ca2e0766ef
Author: Andreas K. Hüttel  gentoo  org>
AuthorDate: Sun Nov 19 13:40:16 2017 +
Commit: Andreas Hüttel  gentoo  org>
CommitDate: Sun Nov 19 13:40:34 2017 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5075159e

sys-devel/gcc: Fix build of gcc-4.9.4 by gcc-6.4.0, bug 638056

Solution found by Zorry

Closes: https://bugs.gentoo.org/638056
Package-Manager: Portage-2.3.14, Repoman-2.3.6

 sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch | 66 +++
 sys-devel/gcc/gcc-4.9.4.ebuild|  5 +-
 2 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch 
b/sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch
new file mode 100644
index 000..aed1ad0e90b
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-4.9.4-bootstrap.patch
@@ -0,0 +1,66 @@
+From 41a4aa66eac45c8862a79351647ec06dd03bd1f5 Mon Sep 17 00:00:00 2001
+From: jakub 
+Date: Sat, 13 Dec 2014 11:24:37 +
+Subject: [PATCH]   PR bootstrap/64023  * Makefile.tpl
+ (EXTRA_TARGET_FLAGS): Set STAGE1_LDFLAGS  to POSTSTAGE1_LDFLAGS and
+ STAGE1_LIBS to POSTSTAGE1_LIBS.   Add -B to libstdc++-v3/src/.libs and
+ libstdc++-v3/libsupc++/.libs  to CXX. * Makefile.in: Regenerated.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218705 
138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ ChangeLog| 9 +
+ Makefile.in  | 6 +-
+ Makefile.tpl | 6 +-
+ 3 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index ba5ae4c2ecb..8ffc313f157 100644
+--- a/Makefile.in
 b/Makefile.in
+@@ -835,7 +835,9 @@ EXTRA_TARGET_FLAGS = \
+   'AS=$(COMPILER_AS_FOR_TARGET)' \
+   'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+   'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
+-  'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
++  'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
++   -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
++   $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+   'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
+   'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
+   'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+@@ -853,6 +855,8 @@ EXTRA_TARGET_FLAGS = \
+   'WINDRES=$$(WINDRES_FOR_TARGET)' \
+   'WINDMC=$$(WINDMC_FOR_TARGET)' \
+   'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
++  'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
++  'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
+   "TFLAGS=$$TFLAGS"
+ 
+ TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
+diff --git a/Makefile.tpl b/Makefile.tpl
+index dcbc6b1b143..bb8227eaafa 100644
+--- a/Makefile.tpl
 b/Makefile.tpl
+@@ -641,7 +641,9 @@ EXTRA_TARGET_FLAGS = \
+   'AS=$(COMPILER_AS_FOR_TARGET)' \
+   'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+   'CFLAGS=$$(CFLAGS_FOR_TARGET)' \
+-  'CXX=$$(CXX_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
++  'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \
++   -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \
++   $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+   'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
+   'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
+   'GCJ=$$(GCJ_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
+@@ -659,6 +661,8 @@ EXTRA_TARGET_FLAGS = \
+   'WINDRES=$$(WINDRES_FOR_TARGET)' \
+   'WINDMC=$$(WINDMC_FOR_TARGET)' \
+   'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \
++  'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \
++  'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \
+   "TFLAGS=$$TFLAGS"
+ 
+ TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
+-- 
+2.15.0
+

diff --git a/sys-devel/gcc/gcc-4.9.4.ebuild b/sys-devel/gcc/gcc-4.9.4.ebuild
index e7562f2330a..44597c4ceec 100644
--- a/sys-devel/gcc/gcc-4.9.4.ebuild
+++ b/sys-devel/gcc/gcc-4.9.4.ebuild
@@ -39,9 +39,12 @@ src_prepare() {
EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
fi
 
+   # Bug 638056
+   epatch "${FILESDIR}/${P}-bootstrap.patch"
+
toolchain_src_prepare
 
use vanilla && return 0
-   #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the 
hardened specs.
+   # Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the 
hardened specs.
[[ ${CHOST} == ${CTARGET} ]] && epatch 
"${FILESDIR}"/gcc-spec-env-r1.patch
 }