public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-06-08 17:03 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-06-08 17:03 UTC (permalink / raw
  To: gentoo-commits

commit:     57f0631d613835def90f12c998feef13b5b7d629
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  8 17:02:35 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun  8 17:02:35 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=57f0631d

15.0.0: drop 76_all_ppc_PR112868-no-checking-many.patch

Drop 76_all_ppc_PR112868-no-checking-many.patch because of
https://gcc.gnu.org/PR113652.

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

 .../76_all_ppc_PR112868-no-checking-many.patch     | 42 ----------------------
 15.0.0/gentoo/README.history                       |  5 +++
 2 files changed, 5 insertions(+), 42 deletions(-)

diff --git a/15.0.0/gentoo/76_all_ppc_PR112868-no-checking-many.patch b/15.0.0/gentoo/76_all_ppc_PR112868-no-checking-many.patch
deleted file mode 100644
index dc9f5e5..0000000
--- a/15.0.0/gentoo/76_all_ppc_PR112868-no-checking-many.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-https://gcc.gnu.org/PR112868 (specifically https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112868#c8)
-(see also https://gcc.gnu.org/PR113652)
-
---- a/gcc/config/rs6000/rs6000.h
-+++ b/gcc/config/rs6000/rs6000.h
-@@ -94,12 +94,6 @@
-   "%{mdejagnu-*: %<mdejagnu-*}", \
-    SUBTARGET_DRIVER_SELF_SPECS
- 
--#if CHECKING_P
--#define ASM_OPT_ANY ""
--#else
--#define ASM_OPT_ANY " -many"
--#endif
--
- /* Common ASM definitions used by ASM_SPEC among the various targets for
-    handling -mcpu=xxx switches.  There is a parallel list in driver-rs6000.cc to
-    provide the default assembler options if the user uses -mcpu=native, so if
-@@ -166,8 +160,7 @@
- 	    mvsx: -mpower7; \
- 	    mpowerpc64: -mppc64;: %(asm_default)}; \
-   :%eMissing -mcpu option in ASM_CPU_SPEC?\n} \
--%{mvsx: -mvsx -maltivec; maltivec: -maltivec}" \
--ASM_OPT_ANY
-+%{mvsx: -mvsx -maltivec; maltivec: -maltivec}"
- 
- #define CPP_DEFAULT_SPEC ""
- 
---- a/gcc/testsuite/lib/target-supports.exp
-+++ b/gcc/testsuite/lib/target-supports.exp
-@@ -7285,7 +7285,7 @@ proc check_effective_target_powerpc_ppu_ok { } {
- #endif
- 		return 0;
- 	    }
--	}]
-+	} "-mcpu=cell"]
-     } else {
- 	return 0
-     }
-
-
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 926ce25..15054c4 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,8 @@
+2	????
+
+	- 76_all_ppc_PR112868-no-checking-many.patch
+
+
 1	28 Apr 2024
 
 	+ 01_all_default-fortify-source.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-06-08 17:03 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-06-08 17:03 UTC (permalink / raw
  To: gentoo-commits

commit:     ab342368b9d0d2ac7f249ca2240644940c51fa78
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  8 17:03:05 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun  8 17:03:19 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ab342368

15.0.0: add 76_all_ppc_PR97367-power7-cell-altivec.patch

Requested by ernsteiswuerfel.

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

 15.0.0/gentoo/76_all_ppc_PR97367-power7-cell-altivec.patch | 13 +++++++++++++
 15.0.0/gentoo/README.history                               |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/76_all_ppc_PR97367-power7-cell-altivec.patch b/15.0.0/gentoo/76_all_ppc_PR97367-power7-cell-altivec.patch
new file mode 100644
index 0000000..154dd0f
--- /dev/null
+++ b/15.0.0/gentoo/76_all_ppc_PR97367-power7-cell-altivec.patch
@@ -0,0 +1,13 @@
+https://gcc.gnu.org/PR97367
+https://inbox.sourceware.org/gcc-patches/20240308.123342.1112119677226246836.rene@exactcode.de/
+--- a/gcc/config/rs6000/rs6000.cc
++++ b/gcc/config/rs6000/rs6000.cc
+@@ -5869,7 +5869,7 @@ rs6000_machine_from_flags (void)
+   HOST_WIDE_INT flags = rs6000_isa_flags;
+ 
+   /* Disable the flags that should never influence the .machine selection.  */
+-  flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ISEL);
++  flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ALTIVEC | OPTION_MASK_ISEL);
+ 
+   if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0)
+     return "power10";

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 15054c4..32feb0a 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,7 +1,7 @@
 2	????
 
 	- 76_all_ppc_PR112868-no-checking-many.patch
-
+	+ 76_all_ppc_PR97367-power7-cell-altivec.patch
 
 1	28 Apr 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-06-10  2:08 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-06-10  2:08 UTC (permalink / raw
  To: gentoo-commits

commit:     6fd8b4c1269795b281ede03ea1e9cd6ed3df1585
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 10 02:05:55 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 10 02:07:30 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=6fd8b4c1

15.0.0: cut patchset 2

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 32feb0a..b2b3de3 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-2	????
+2	10 June 2024
 
 	- 76_all_ppc_PR112868-no-checking-many.patch
 	+ 76_all_ppc_PR97367-power7-cell-altivec.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-06-10 17:28 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-06-10 17:28 UTC (permalink / raw
  To: gentoo-commits

commit:     75e80ce24ee1b7a17c13e9e513cab5ba81635262
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 10 17:25:14 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 10 17:25:14 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=75e80ce2

15.0.0: backport two fixes

A severe miscompilation and a severe ICE fix.

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

 15.0.0/gentoo/77_all_PR115387.patch | 206 ++++++++++++++++++++++++++++++++++++
 15.0.0/gentoo/78_all_PR115395.patch | 107 +++++++++++++++++++
 15.0.0/gentoo/README.history        |   5 +
 3 files changed, 318 insertions(+)

diff --git a/15.0.0/gentoo/77_all_PR115387.patch b/15.0.0/gentoo/77_all_PR115387.patch
new file mode 100644
index 0000000..bf143e7
--- /dev/null
+++ b/15.0.0/gentoo/77_all_PR115387.patch
@@ -0,0 +1,206 @@
+https://gcc.gnu.org/PR115387
+https://inbox.sourceware.org/gcc-patches/430da3ad-59a6-4f16-b35f-8bef724a7ed7@gmail.com/T/#t
+
+From mboxrd@z Thu Jan  1 00:00:00 1970
+Return-Path: <SRS0=SYw7=NM=intel.com=pan2.li@sourceware.org>
+Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14])
+	by sourceware.org (Postfix) with ESMTPS id 48A883858CDB
+	for <gcc-patches@gcc.gnu.org>; Mon, 10 Jun 2024 14:49:07 +0000 (GMT)
+DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 48A883858CDB
+Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com
+Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com
+ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 48A883858CDB
+Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.14
+ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718030949; cv=none;
+	b=sYMAFxaXXHzkHsYoFI0HFGXWzujiQRXs1KA4PpQKerabnFz185hAazNZgv5HRn33NHy30a6CaFSGdNqMzI5rJ/uWP0t/IVSZPws+DkO9GCBPkgQLIHvRRf5J+uf7usxHf+quk0tjfzrDkHctT7riGqQjzSEAkBTwrKXd7X9aQ9k=
+ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
+	t=1718030949; c=relaxed/simple;
+	bh=p/hDLfesLAxds7UkloKeUvZGINWc0ydc/cnr4ptMBSU=;
+	h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=GtE3ODQcVtLdsf2+edm43ZWyfgTSrruAj3RQ1zIcTMeifKot7fY59t2YIAFrSyx/vKLMuPwocIQ8p3VmYLj4DB2f8ybXvEhBcx2pxlh5GNVmPxjGtJsnrv6p7oMG9CA6X/bns8vlMhr2CgwzHRba7bItkwFWjKkI8gbJz3v9zeo=
+ARC-Authentication-Results: i=1; server2.sourceware.org
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
+  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
+  t=1718030948; x=1749566948;
+  h=from:to:cc:subject:date:message-id:mime-version:
+   content-transfer-encoding;
+  bh=p/hDLfesLAxds7UkloKeUvZGINWc0ydc/cnr4ptMBSU=;
+  b=biitKQIpbkCUKRo31CQVWz5tQ3QP6AsTulnDi3LB7cDTMJflku4VDWDx
+   Dnu97Pvn/2HzgfrZyN+1kVfGvLnehrErvG2qw3kZ2PGu0AiKrtnTRj0ED
+   UdyWa4+MQF5nj34UK92MRcA1Ovou3O89YdQ11EmVuL1KynSTtKgwo/d/9
+   JsYn3MkWZP6NjVgZteOu5xBZF+J3NxK61azjaUgP8LIxo1bmEKUMBgo0f
+   p0gXtZXjZkxtpcqzr++CtB6e4fKUHQK8z/FjOzaHvwIzmxdoEcptRGtl9
+   v+2kXKMcvMQGZZlsBfFIewmNKjK6qUYGrDKl1wltMZMkeijuudmObyhaq
+   A==;
+X-CSE-ConnectionGUID: JaJ1NR5jSimBRrZvjuM+Lw==
+X-CSE-MsgGUID: Q6rSZfGaQfOHvXT9LPs02g==
+X-IronPort-AV: E=McAfee;i="6600,9927,11099"; a="18526139"
+X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; 
+   d="scan'208";a="18526139"
+Received: from orviesa002.jf.intel.com ([10.64.159.142])
+  by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2024 07:49:07 -0700
+X-CSE-ConnectionGUID: +SJ6B8QPQfWwhjgjPJujEw==
+X-CSE-MsgGUID: eHhYmO22SKyPWaJe7LW77Q==
+X-ExtLoop1: 1
+X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; 
+   d="scan'208";a="69872329"
+Received: from shvmail03.sh.intel.com ([10.239.245.20])
+  by orviesa002.jf.intel.com with ESMTP; 10 Jun 2024 07:49:04 -0700
+Received: from pli-ubuntu.sh.intel.com (pli-ubuntu.sh.intel.com [10.239.159.47])
+	by shvmail03.sh.intel.com (Postfix) with ESMTP id E43A71007C1D;
+	Mon, 10 Jun 2024 22:49:02 +0800 (CST)
+From: pan2.li@intel.com
+To: gcc-patches@gcc.gnu.org
+Cc: juzhe.zhong@rivai.ai,
+	kito.cheng@gmail.com,
+	richard.guenther@gmail.com,
+	Pan Li <pan2.li@intel.com>
+Subject: [PATCH v1] Widening-Mul: Fix one ICE of gcall insertion for PHI match
+Date: Mon, 10 Jun 2024 22:49:01 +0800
+Message-Id: <20240610144901.3723532-1-pan2.li@intel.com>
+X-Mailer: git-send-email 2.34.1
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
+X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org
+List-Id: <gcc-patches.gcc.gnu.org>
+
+From: Pan Li <pan2.li@intel.com>
+
+When enabled the PHI handing for COND_EXPR,  we need to insert the gcall
+to replace the PHI node.  Unfortunately,  I made a mistake that insert
+the gcall to before the last stmt of the bb.  See below gimple,  the PHI
+is located at no.1 but we insert the gcall (aka no.9) to the end of
+the bb.  Then the use of _9 in no.2 will have no def and will trigger
+ICE when verify_ssa.
+
+  1. # _9 = PHI <_3(4), 18446744073709551615(3)> // The PHI node to be deleted.
+  2. prephitmp_36 = (char *) _9;
+  3. buf.write_base = string_13(D);
+  4. buf.write_ptr = string_13(D);
+  5. buf.write_end = prephitmp_36;
+  6. buf.written = 0;
+  7. buf.mode = 3;
+  8. _7 = buf.write_end;
+  9. _9 = .SAT_ADD (string.0_2, maxlen_15(D));   // Insert gcall to last bb by mistake
+
+This patch would like to insert the gcall to before the start of the bb
+stmt.  To ensure the possible use of PHI_result will have a def exists.
+After this patch the above gimple will be:
+
+  0. _9 = .SAT_ADD (string.0_2, maxlen_15(D));   // Insert gcall to start bb by mistake
+  1. # _9 = PHI <_3(4), 18446744073709551615(3)> // The PHI node to be deleted.
+  2. prephitmp_36 = (char *) _9;
+  3. buf.write_base = string_13(D);
+  4. buf.write_ptr = string_13(D);
+  5. buf.write_end = prephitmp_36;
+  6. buf.written = 0;
+  7. buf.mode = 3;
+  8. _7 = buf.write_end;
+
+The below test suites are passed for this patch:
+* The rv64gcv fully regression test with newlib.
+* The rv64gcv build with glibc.
+* The x86 regression test with newlib.
+* The x86 bootstrap test with newlib.
+
+	PR target/115387
+
+gcc/ChangeLog:
+
+	* tree-ssa-math-opts.cc (math_opts_dom_walker::after_dom_children): Take
+	the gsi of start_bb instead of last_bb.
+
+gcc/testsuite/ChangeLog:
+
+	* gcc.target/riscv/pr115387-1.c: New test.
+	* gcc.target/riscv/pr115387-2.c: New test.
+
+Signed-off-by: Pan Li <pan2.li@intel.com>
+---
+ gcc/testsuite/gcc.target/riscv/pr115387-1.c | 35 +++++++++++++++++++++
+ gcc/testsuite/gcc.target/riscv/pr115387-2.c | 18 +++++++++++
+ gcc/tree-ssa-math-opts.cc                   |  2 +-
+ 3 files changed, 54 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/gcc.target/riscv/pr115387-1.c
+ create mode 100644 gcc/testsuite/gcc.target/riscv/pr115387-2.c
+
+diff --git a/gcc/testsuite/gcc.target/riscv/pr115387-1.c b/gcc/testsuite/gcc.target/riscv/pr115387-1.c
+new file mode 100644
+index 00000000000..a1c926977c4
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/riscv/pr115387-1.c
+@@ -0,0 +1,35 @@
++/* Test there is no ICE when compile.  */
++/* { dg-do compile } */
++/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */
++
++#define PRINTF_CHK 0x34
++
++typedef unsigned long uintptr_t;
++
++struct __printf_buffer {
++  char *write_ptr;
++  int status;
++};
++
++extern void __printf_buffer_init_end (struct __printf_buffer *, char *, char *);
++
++void
++test (char *string, unsigned long maxlen, unsigned mode_flags)
++{
++  struct __printf_buffer buf;
++
++  if ((mode_flags & PRINTF_CHK) != 0)
++    {
++      string[0] = '\0';
++      uintptr_t end;
++
++      if (__builtin_add_overflow ((uintptr_t) string, maxlen, &end))
++	end = -1;
++
++      __printf_buffer_init_end (&buf, string, (char *) end);
++    }
++  else
++    __printf_buffer_init_end (&buf, string, (char *) ~(uintptr_t) 0);
++
++  *buf.write_ptr = '\0';
++}
+diff --git a/gcc/testsuite/gcc.target/riscv/pr115387-2.c b/gcc/testsuite/gcc.target/riscv/pr115387-2.c
+new file mode 100644
+index 00000000000..7183bf18dfd
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/riscv/pr115387-2.c
+@@ -0,0 +1,18 @@
++/* Test there is no ICE when compile.  */
++/* { dg-do compile } */
++/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */
++
++#include <stddef.h>
++#include <stdint-gcc.h>
++
++char *
++test (char *string, size_t maxlen)
++{
++  string[0] = '\0';
++  uintptr_t end;
++
++  if (__builtin_add_overflow ((uintptr_t) string, maxlen, &end))
++    end = -1;
++
++  return (char *) end;
++}
+diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc
+index 173b0366f5e..fbb8e0ea306 100644
+--- a/gcc/tree-ssa-math-opts.cc
++++ b/gcc/tree-ssa-math-opts.cc
+@@ -6102,7 +6102,7 @@ math_opts_dom_walker::after_dom_children (basic_block bb)
+   for (gphi_iterator psi = gsi_start_phis (bb); !gsi_end_p (psi);
+     gsi_next (&psi))
+     {
+-      gimple_stmt_iterator gsi = gsi_last_bb (bb);
++      gimple_stmt_iterator gsi = gsi_start_bb (bb);
+       match_unsigned_saturation_add (&gsi, psi.phi ());
+     }
+ 
+-- 
+2.34.1

diff --git a/15.0.0/gentoo/78_all_PR115395.patch b/15.0.0/gentoo/78_all_PR115395.patch
new file mode 100644
index 0000000..d98c043
--- /dev/null
+++ b/15.0.0/gentoo/78_all_PR115395.patch
@@ -0,0 +1,107 @@
+https://gcc.gnu.org/PR115395
+
+From 4ed9c5df7efeb98e190573cca42a4fd40666c45f Mon Sep 17 00:00:00 2001
+From: Richard Biener <rguenther@suse.de>
+Date: Mon, 10 Jun 2024 10:12:52 +0200
+Subject: [PATCH] tree-optimization/115395 - wrong-code with SLP reduction in
+ epilog
+
+When we continue a non-SLP reduction from the main loop in the
+epilog with a SLP reduction we currently fail to handle an
+adjustment by the initial value because that's not a thing with SLP.
+As long as we have the possibility to mix SLP and non-SLP we have
+to handle it though.
+
+	PR tree-optimization/115395
+	* tree-vect-loop.cc (vect_create_epilog_for_reduction):
+	Handle STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT also for SLP
+	reductions of group_size one.
+
+	* gcc.dg/vect/pr115395.c: New testcase.
+---
+ gcc/testsuite/gcc.dg/vect/pr115395.c | 27 +++++++++++++++++++++++++++
+ gcc/tree-vect-loop.cc                | 27 ++++++++-------------------
+ 2 files changed, 35 insertions(+), 19 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/vect/pr115395.c
+
+diff --git a/gcc/testsuite/gcc.dg/vect/pr115395.c b/gcc/testsuite/gcc.dg/vect/pr115395.c
+new file mode 100644
+index 00000000000..cd1cee9f3df
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/vect/pr115395.c
+@@ -0,0 +1,27 @@
++/* { dg-additional-options "-mavx2" { target avx2_runtime } } */
++
++#include "tree-vect.h"
++
++struct {
++  long header_size;
++  long start_offset;
++  long end_offset;
++} myrar_dbo[5] = {{0, 87, 6980}, {0, 7087, 13980}, {0, 14087, 0}};
++
++int i;
++long offset;
++
++int main()
++{
++  check_vect ();
++
++  offset += myrar_dbo[0].start_offset;
++  while (i < 2) {
++    i++;
++    offset += myrar_dbo[i].start_offset - myrar_dbo[i - 1].end_offset;
++  }
++  if (offset != 301)
++    abort();
++
++  return 0;
++}
+diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
+index 028692614bb..c471f1564a7 100644
+--- a/gcc/tree-vect-loop.cc
++++ b/gcc/tree-vect-loop.cc
+@@ -6030,25 +6030,14 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
+ 
+   tree induc_val = NULL_TREE;
+   tree adjustment_def = NULL;
+-  if (slp_node)
+-    {
+-      /* Optimize: for induction condition reduction, if we can't use zero
+-	 for induc_val, use initial_def.  */
+-      if (STMT_VINFO_REDUC_TYPE (reduc_info) == INTEGER_INDUC_COND_REDUCTION)
+-	induc_val = STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info);
+-      /* ???  Coverage for 'else' isn't clear.  */
+-    }
++  /* Optimize: for induction condition reduction, if we can't use zero
++     for induc_val, use initial_def.  */
++  if (STMT_VINFO_REDUC_TYPE (reduc_info) == INTEGER_INDUC_COND_REDUCTION)
++    induc_val = STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info);
++  else if (double_reduc)
++    ;
+   else
+-    {
+-      /* Optimize: for induction condition reduction, if we can't use zero
+-         for induc_val, use initial_def.  */
+-      if (STMT_VINFO_REDUC_TYPE (reduc_info) == INTEGER_INDUC_COND_REDUCTION)
+-	induc_val = STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info);
+-      else if (double_reduc)
+-	;
+-      else
+-	adjustment_def = STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT (reduc_info);
+-    }
++    adjustment_def = STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT (reduc_info);
+ 
+   stmt_vec_info single_live_out_stmt[] = { stmt_info };
+   array_slice<const stmt_vec_info> live_out_stmts = single_live_out_stmt;
+@@ -6873,7 +6862,7 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
+ 
+   if (adjustment_def)
+     {
+-      gcc_assert (!slp_reduc);
++      gcc_assert (!slp_reduc || group_size == 1);
+       gimple_seq stmts = NULL;
+       if (double_reduc)
+ 	{
+-- 
+2.43.0

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index b2b3de3..1573b55 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,8 @@
+3	10 June 2024
+
+	+ 77_all_PR115387.patch
+	+ 78_all_PR115395.patch
+
 2	10 June 2024
 
 	- 76_all_ppc_PR112868-no-checking-many.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-06-10 17:28 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-06-10 17:28 UTC (permalink / raw
  To: gentoo-commits

commit:     98503e61e8b723a012ccef2eed6a8387e43535e7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 10 17:28:02 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 10 17:28:02 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=98503e61

15.0.0: drop upstreamed patch

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

 15.0.0/gentoo/78_all_PR115395.patch | 107 ------------------------------------
 15.0.0/gentoo/README.history        |   4 ++
 2 files changed, 4 insertions(+), 107 deletions(-)

diff --git a/15.0.0/gentoo/78_all_PR115395.patch b/15.0.0/gentoo/78_all_PR115395.patch
deleted file mode 100644
index d98c043..0000000
--- a/15.0.0/gentoo/78_all_PR115395.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-https://gcc.gnu.org/PR115395
-
-From 4ed9c5df7efeb98e190573cca42a4fd40666c45f Mon Sep 17 00:00:00 2001
-From: Richard Biener <rguenther@suse.de>
-Date: Mon, 10 Jun 2024 10:12:52 +0200
-Subject: [PATCH] tree-optimization/115395 - wrong-code with SLP reduction in
- epilog
-
-When we continue a non-SLP reduction from the main loop in the
-epilog with a SLP reduction we currently fail to handle an
-adjustment by the initial value because that's not a thing with SLP.
-As long as we have the possibility to mix SLP and non-SLP we have
-to handle it though.
-
-	PR tree-optimization/115395
-	* tree-vect-loop.cc (vect_create_epilog_for_reduction):
-	Handle STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT also for SLP
-	reductions of group_size one.
-
-	* gcc.dg/vect/pr115395.c: New testcase.
----
- gcc/testsuite/gcc.dg/vect/pr115395.c | 27 +++++++++++++++++++++++++++
- gcc/tree-vect-loop.cc                | 27 ++++++++-------------------
- 2 files changed, 35 insertions(+), 19 deletions(-)
- create mode 100644 gcc/testsuite/gcc.dg/vect/pr115395.c
-
-diff --git a/gcc/testsuite/gcc.dg/vect/pr115395.c b/gcc/testsuite/gcc.dg/vect/pr115395.c
-new file mode 100644
-index 00000000000..cd1cee9f3df
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/vect/pr115395.c
-@@ -0,0 +1,27 @@
-+/* { dg-additional-options "-mavx2" { target avx2_runtime } } */
-+
-+#include "tree-vect.h"
-+
-+struct {
-+  long header_size;
-+  long start_offset;
-+  long end_offset;
-+} myrar_dbo[5] = {{0, 87, 6980}, {0, 7087, 13980}, {0, 14087, 0}};
-+
-+int i;
-+long offset;
-+
-+int main()
-+{
-+  check_vect ();
-+
-+  offset += myrar_dbo[0].start_offset;
-+  while (i < 2) {
-+    i++;
-+    offset += myrar_dbo[i].start_offset - myrar_dbo[i - 1].end_offset;
-+  }
-+  if (offset != 301)
-+    abort();
-+
-+  return 0;
-+}
-diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
-index 028692614bb..c471f1564a7 100644
---- a/gcc/tree-vect-loop.cc
-+++ b/gcc/tree-vect-loop.cc
-@@ -6030,25 +6030,14 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
- 
-   tree induc_val = NULL_TREE;
-   tree adjustment_def = NULL;
--  if (slp_node)
--    {
--      /* Optimize: for induction condition reduction, if we can't use zero
--	 for induc_val, use initial_def.  */
--      if (STMT_VINFO_REDUC_TYPE (reduc_info) == INTEGER_INDUC_COND_REDUCTION)
--	induc_val = STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info);
--      /* ???  Coverage for 'else' isn't clear.  */
--    }
-+  /* Optimize: for induction condition reduction, if we can't use zero
-+     for induc_val, use initial_def.  */
-+  if (STMT_VINFO_REDUC_TYPE (reduc_info) == INTEGER_INDUC_COND_REDUCTION)
-+    induc_val = STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info);
-+  else if (double_reduc)
-+    ;
-   else
--    {
--      /* Optimize: for induction condition reduction, if we can't use zero
--         for induc_val, use initial_def.  */
--      if (STMT_VINFO_REDUC_TYPE (reduc_info) == INTEGER_INDUC_COND_REDUCTION)
--	induc_val = STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info);
--      else if (double_reduc)
--	;
--      else
--	adjustment_def = STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT (reduc_info);
--    }
-+    adjustment_def = STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT (reduc_info);
- 
-   stmt_vec_info single_live_out_stmt[] = { stmt_info };
-   array_slice<const stmt_vec_info> live_out_stmts = single_live_out_stmt;
-@@ -6873,7 +6862,7 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
- 
-   if (adjustment_def)
-     {
--      gcc_assert (!slp_reduc);
-+      gcc_assert (!slp_reduc || group_size == 1);
-       gimple_seq stmts = NULL;
-       if (double_reduc)
- 	{
--- 
-2.43.0

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 1573b55..81ca552 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+4	????
+
+	- 78_all_PR115395.patch
+
 3	10 June 2024
 
 	+ 77_all_PR115387.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-06-10 20:18 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-06-10 20:18 UTC (permalink / raw
  To: gentoo-commits

commit:     c8bf41759fe849050fcb5c5105483c9db6b15da2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 10 20:18:07 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 10 20:18:07 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c8bf4175

15.0.0: drop upstream 77_all_PR115387.patch

It got merged.

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

 15.0.0/gentoo/77_all_PR115387.patch | 206 ------------------------------------
 15.0.0/gentoo/README.history        |   1 +
 2 files changed, 1 insertion(+), 206 deletions(-)

diff --git a/15.0.0/gentoo/77_all_PR115387.patch b/15.0.0/gentoo/77_all_PR115387.patch
deleted file mode 100644
index bf143e7..0000000
--- a/15.0.0/gentoo/77_all_PR115387.patch
+++ /dev/null
@@ -1,206 +0,0 @@
-https://gcc.gnu.org/PR115387
-https://inbox.sourceware.org/gcc-patches/430da3ad-59a6-4f16-b35f-8bef724a7ed7@gmail.com/T/#t
-
-From mboxrd@z Thu Jan  1 00:00:00 1970
-Return-Path: <SRS0=SYw7=NM=intel.com=pan2.li@sourceware.org>
-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14])
-	by sourceware.org (Postfix) with ESMTPS id 48A883858CDB
-	for <gcc-patches@gcc.gnu.org>; Mon, 10 Jun 2024 14:49:07 +0000 (GMT)
-DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 48A883858CDB
-Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com
-Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com
-ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 48A883858CDB
-Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.14
-ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718030949; cv=none;
-	b=sYMAFxaXXHzkHsYoFI0HFGXWzujiQRXs1KA4PpQKerabnFz185hAazNZgv5HRn33NHy30a6CaFSGdNqMzI5rJ/uWP0t/IVSZPws+DkO9GCBPkgQLIHvRRf5J+uf7usxHf+quk0tjfzrDkHctT7riGqQjzSEAkBTwrKXd7X9aQ9k=
-ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
-	t=1718030949; c=relaxed/simple;
-	bh=p/hDLfesLAxds7UkloKeUvZGINWc0ydc/cnr4ptMBSU=;
-	h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=GtE3ODQcVtLdsf2+edm43ZWyfgTSrruAj3RQ1zIcTMeifKot7fY59t2YIAFrSyx/vKLMuPwocIQ8p3VmYLj4DB2f8ybXvEhBcx2pxlh5GNVmPxjGtJsnrv6p7oMG9CA6X/bns8vlMhr2CgwzHRba7bItkwFWjKkI8gbJz3v9zeo=
-ARC-Authentication-Results: i=1; server2.sourceware.org
-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
-  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
-  t=1718030948; x=1749566948;
-  h=from:to:cc:subject:date:message-id:mime-version:
-   content-transfer-encoding;
-  bh=p/hDLfesLAxds7UkloKeUvZGINWc0ydc/cnr4ptMBSU=;
-  b=biitKQIpbkCUKRo31CQVWz5tQ3QP6AsTulnDi3LB7cDTMJflku4VDWDx
-   Dnu97Pvn/2HzgfrZyN+1kVfGvLnehrErvG2qw3kZ2PGu0AiKrtnTRj0ED
-   UdyWa4+MQF5nj34UK92MRcA1Ovou3O89YdQ11EmVuL1KynSTtKgwo/d/9
-   JsYn3MkWZP6NjVgZteOu5xBZF+J3NxK61azjaUgP8LIxo1bmEKUMBgo0f
-   p0gXtZXjZkxtpcqzr++CtB6e4fKUHQK8z/FjOzaHvwIzmxdoEcptRGtl9
-   v+2kXKMcvMQGZZlsBfFIewmNKjK6qUYGrDKl1wltMZMkeijuudmObyhaq
-   A==;
-X-CSE-ConnectionGUID: JaJ1NR5jSimBRrZvjuM+Lw==
-X-CSE-MsgGUID: Q6rSZfGaQfOHvXT9LPs02g==
-X-IronPort-AV: E=McAfee;i="6600,9927,11099"; a="18526139"
-X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; 
-   d="scan'208";a="18526139"
-Received: from orviesa002.jf.intel.com ([10.64.159.142])
-  by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2024 07:49:07 -0700
-X-CSE-ConnectionGUID: +SJ6B8QPQfWwhjgjPJujEw==
-X-CSE-MsgGUID: eHhYmO22SKyPWaJe7LW77Q==
-X-ExtLoop1: 1
-X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; 
-   d="scan'208";a="69872329"
-Received: from shvmail03.sh.intel.com ([10.239.245.20])
-  by orviesa002.jf.intel.com with ESMTP; 10 Jun 2024 07:49:04 -0700
-Received: from pli-ubuntu.sh.intel.com (pli-ubuntu.sh.intel.com [10.239.159.47])
-	by shvmail03.sh.intel.com (Postfix) with ESMTP id E43A71007C1D;
-	Mon, 10 Jun 2024 22:49:02 +0800 (CST)
-From: pan2.li@intel.com
-To: gcc-patches@gcc.gnu.org
-Cc: juzhe.zhong@rivai.ai,
-	kito.cheng@gmail.com,
-	richard.guenther@gmail.com,
-	Pan Li <pan2.li@intel.com>
-Subject: [PATCH v1] Widening-Mul: Fix one ICE of gcall insertion for PHI match
-Date: Mon, 10 Jun 2024 22:49:01 +0800
-Message-Id: <20240610144901.3723532-1-pan2.li@intel.com>
-X-Mailer: git-send-email 2.34.1
-MIME-Version: 1.0
-Content-Transfer-Encoding: 8bit
-X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
-X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org
-List-Id: <gcc-patches.gcc.gnu.org>
-
-From: Pan Li <pan2.li@intel.com>
-
-When enabled the PHI handing for COND_EXPR,  we need to insert the gcall
-to replace the PHI node.  Unfortunately,  I made a mistake that insert
-the gcall to before the last stmt of the bb.  See below gimple,  the PHI
-is located at no.1 but we insert the gcall (aka no.9) to the end of
-the bb.  Then the use of _9 in no.2 will have no def and will trigger
-ICE when verify_ssa.
-
-  1. # _9 = PHI <_3(4), 18446744073709551615(3)> // The PHI node to be deleted.
-  2. prephitmp_36 = (char *) _9;
-  3. buf.write_base = string_13(D);
-  4. buf.write_ptr = string_13(D);
-  5. buf.write_end = prephitmp_36;
-  6. buf.written = 0;
-  7. buf.mode = 3;
-  8. _7 = buf.write_end;
-  9. _9 = .SAT_ADD (string.0_2, maxlen_15(D));   // Insert gcall to last bb by mistake
-
-This patch would like to insert the gcall to before the start of the bb
-stmt.  To ensure the possible use of PHI_result will have a def exists.
-After this patch the above gimple will be:
-
-  0. _9 = .SAT_ADD (string.0_2, maxlen_15(D));   // Insert gcall to start bb by mistake
-  1. # _9 = PHI <_3(4), 18446744073709551615(3)> // The PHI node to be deleted.
-  2. prephitmp_36 = (char *) _9;
-  3. buf.write_base = string_13(D);
-  4. buf.write_ptr = string_13(D);
-  5. buf.write_end = prephitmp_36;
-  6. buf.written = 0;
-  7. buf.mode = 3;
-  8. _7 = buf.write_end;
-
-The below test suites are passed for this patch:
-* The rv64gcv fully regression test with newlib.
-* The rv64gcv build with glibc.
-* The x86 regression test with newlib.
-* The x86 bootstrap test with newlib.
-
-	PR target/115387
-
-gcc/ChangeLog:
-
-	* tree-ssa-math-opts.cc (math_opts_dom_walker::after_dom_children): Take
-	the gsi of start_bb instead of last_bb.
-
-gcc/testsuite/ChangeLog:
-
-	* gcc.target/riscv/pr115387-1.c: New test.
-	* gcc.target/riscv/pr115387-2.c: New test.
-
-Signed-off-by: Pan Li <pan2.li@intel.com>
----
- gcc/testsuite/gcc.target/riscv/pr115387-1.c | 35 +++++++++++++++++++++
- gcc/testsuite/gcc.target/riscv/pr115387-2.c | 18 +++++++++++
- gcc/tree-ssa-math-opts.cc                   |  2 +-
- 3 files changed, 54 insertions(+), 1 deletion(-)
- create mode 100644 gcc/testsuite/gcc.target/riscv/pr115387-1.c
- create mode 100644 gcc/testsuite/gcc.target/riscv/pr115387-2.c
-
-diff --git a/gcc/testsuite/gcc.target/riscv/pr115387-1.c b/gcc/testsuite/gcc.target/riscv/pr115387-1.c
-new file mode 100644
-index 00000000000..a1c926977c4
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/riscv/pr115387-1.c
-@@ -0,0 +1,35 @@
-+/* Test there is no ICE when compile.  */
-+/* { dg-do compile } */
-+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */
-+
-+#define PRINTF_CHK 0x34
-+
-+typedef unsigned long uintptr_t;
-+
-+struct __printf_buffer {
-+  char *write_ptr;
-+  int status;
-+};
-+
-+extern void __printf_buffer_init_end (struct __printf_buffer *, char *, char *);
-+
-+void
-+test (char *string, unsigned long maxlen, unsigned mode_flags)
-+{
-+  struct __printf_buffer buf;
-+
-+  if ((mode_flags & PRINTF_CHK) != 0)
-+    {
-+      string[0] = '\0';
-+      uintptr_t end;
-+
-+      if (__builtin_add_overflow ((uintptr_t) string, maxlen, &end))
-+	end = -1;
-+
-+      __printf_buffer_init_end (&buf, string, (char *) end);
-+    }
-+  else
-+    __printf_buffer_init_end (&buf, string, (char *) ~(uintptr_t) 0);
-+
-+  *buf.write_ptr = '\0';
-+}
-diff --git a/gcc/testsuite/gcc.target/riscv/pr115387-2.c b/gcc/testsuite/gcc.target/riscv/pr115387-2.c
-new file mode 100644
-index 00000000000..7183bf18dfd
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/riscv/pr115387-2.c
-@@ -0,0 +1,18 @@
-+/* Test there is no ICE when compile.  */
-+/* { dg-do compile } */
-+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */
-+
-+#include <stddef.h>
-+#include <stdint-gcc.h>
-+
-+char *
-+test (char *string, size_t maxlen)
-+{
-+  string[0] = '\0';
-+  uintptr_t end;
-+
-+  if (__builtin_add_overflow ((uintptr_t) string, maxlen, &end))
-+    end = -1;
-+
-+  return (char *) end;
-+}
-diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc
-index 173b0366f5e..fbb8e0ea306 100644
---- a/gcc/tree-ssa-math-opts.cc
-+++ b/gcc/tree-ssa-math-opts.cc
-@@ -6102,7 +6102,7 @@ math_opts_dom_walker::after_dom_children (basic_block bb)
-   for (gphi_iterator psi = gsi_start_phis (bb); !gsi_end_p (psi);
-     gsi_next (&psi))
-     {
--      gimple_stmt_iterator gsi = gsi_last_bb (bb);
-+      gimple_stmt_iterator gsi = gsi_start_bb (bb);
-       match_unsigned_saturation_add (&gsi, psi.phi ());
-     }
- 
--- 
-2.34.1

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 81ca552..6c43a46 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,5 +1,6 @@
 4	????
 
+	- 77_all_PR115387.patch
 	- 78_all_PR115395.patch
 
 3	10 June 2024


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-06-16 22:45 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-06-16 22:45 UTC (permalink / raw
  To: gentoo-commits

commit:     9b921e3a315f6c478a72c39a444ed694438fdcb2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 16 22:45:05 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun 16 22:45:05 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9b921e3a

15.0.0: cut patchset 4

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 6c43a46..efe48af 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-4	????
+4	16 June 2024
 
 	- 77_all_PR115387.patch
 	- 78_all_PR115395.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-06-26 23:57 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-06-26 23:57 UTC (permalink / raw
  To: gentoo-commits

commit:     e35c53788a928179ef26b76833bcbe297f84fe6a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 26 23:57:28 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 26 23:57:52 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e35c5378

15.0.0: workaround recent x86 changes

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

 .../gentoo/77_all_i386-fix-ix86_expand_move.patch  | 45 ++++++++++
 .../78_all_i386-fix-recent-alias-set-change.patch  | 95 ++++++++++++++++++++++
 2 files changed, 140 insertions(+)

diff --git a/15.0.0/gentoo/77_all_i386-fix-ix86_expand_move.patch b/15.0.0/gentoo/77_all_i386-fix-ix86_expand_move.patch
new file mode 100644
index 0000000..4b42ea9
--- /dev/null
+++ b/15.0.0/gentoo/77_all_i386-fix-ix86_expand_move.patch
@@ -0,0 +1,45 @@
+From ec0ead755e65ba51813aa8b66f4eb5574dd8437c Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Wed, 26 Jun 2024 13:19:42 +0100
+Subject: [PATCH 1/2] i386: fix ix86_expand_move
+
+Before r15-1599-g63512c72df09b4, legitimize_pe_coff_symbol would return NULL_RTX
+for non-PECOFF targets, so the else branch would get taken.
+
+(This is a hack which doesn't work for PECOFF targets but fixes miscompilations
+on ELF.)
+
+Bug: https://gcc.gnu.org/PR115635
+Bug: https://gcc.gnu.org/PR115661
+---
+ gcc/config/i386/i386-expand.cc | 10 ----------
+ 1 file changed, 10 deletions(-)
+
+diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
+index 5dfa7d49f58c..5e0173bc7a84 100644
+--- a/gcc/config/i386/i386-expand.cc
++++ b/gcc/config/i386/i386-expand.cc
+@@ -412,20 +412,10 @@ ix86_expand_move (machine_mode mode, rtx operands[])
+ 	}
+       else
+ 	{
+-#if TARGET_PECOFF
+-	  tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
+-	  if (tmp)
+-	    {
+-	      op1 = tmp;
+-	      if (!addend)
+-		break;
+-	    }
+-	  else
+ 	    {
+ 	      op1 = operands[1];
+ 	      break;
+ 	    }
+-#endif
+ 	}
+ 
+       if (addend)
+-- 
+2.45.2
+

diff --git a/15.0.0/gentoo/78_all_i386-fix-recent-alias-set-change.patch b/15.0.0/gentoo/78_all_i386-fix-recent-alias-set-change.patch
new file mode 100644
index 0000000..6776fdd
--- /dev/null
+++ b/15.0.0/gentoo/78_all_i386-fix-recent-alias-set-change.patch
@@ -0,0 +1,95 @@
+From 72a4d2d437782afa975f9b29c3ab4a1826ad0cd6 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Wed, 26 Jun 2024 12:54:55 +0100
+Subject: [PATCH 2/2] i386: fix recent alias set change
+
+Before r15-1599-g63512c72df09b4, we would create a new alias set, but now
+we use -1. Go back to using ix86_GOT_alias_set.
+
+(This is a hack which isn't the cleanest way of fixing it.)
+
+Bug: https://gcc.gnu.org/PR115635
+Bug: https://gcc.gnu.org/PR115661
+---
+ gcc/config/i386/i386-expand.cc |  2 +-
+ gcc/config/i386/i386-expand.h  |  1 +
+ gcc/config/i386/i386.cc        | 17 ++++++++++++++---
+ 3 files changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
+index 5e0173bc7a84..3345f40ad85d 100644
+--- a/gcc/config/i386/i386-expand.cc
++++ b/gcc/config/i386/i386-expand.cc
+@@ -408,7 +408,7 @@ ix86_expand_move (machine_mode mode, rtx operands[])
+ 				 : UNSPEC_GOT));
+ 	  op1 = gen_rtx_CONST (Pmode, op1);
+ 	  op1 = gen_const_mem (Pmode, op1);
+-	  set_mem_alias_set (op1, GOT_ALIAS_SET);
++	  set_mem_alias_set (op1, ix86_GOT_alias_set ());
+ 	}
+       else
+ 	{
+diff --git a/gcc/config/i386/i386-expand.h b/gcc/config/i386/i386-expand.h
+index 5e02df1706df..56bee29253ba 100644
+--- a/gcc/config/i386/i386-expand.h
++++ b/gcc/config/i386/i386-expand.h
+@@ -34,6 +34,7 @@ struct expand_vec_perm_d
+ };
+ 
+ rtx legitimize_tls_address (rtx x, enum tls_model model, bool for_mov);
++alias_set_type ix86_GOT_alias_set (void);
+ rtx legitimize_pic_address (rtx orig, rtx reg);
+ 
+ bool insn_defines_reg (unsigned int regno1, unsigned int regno2,
+diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
+index 1f71ed04be67..62fca080f2f5 100644
+--- a/gcc/config/i386/i386.cc
++++ b/gcc/config/i386/i386.cc
+@@ -11823,6 +11823,17 @@ constant_address_p (rtx x)
+ }
+ \f
+ 
++/* Return a unique alias set for the GOT.  */
++
++alias_set_type
++ix86_GOT_alias_set (void)
++{
++  static alias_set_type set = -1;
++  if (set == -1)
++    set = new_alias_set ();
++  return set;
++}
++
+ /* Return a legitimate reference for ORIG (an address) using the
+    register REG.  If REG is 0, a new pseudo is generated.
+ 
+@@ -11925,7 +11936,7 @@ legitimize_pic_address (rtx orig, rtx reg)
+ 				    UNSPEC_GOTPCREL);
+ 	  new_rtx = gen_rtx_CONST (Pmode, new_rtx);
+ 	  new_rtx = gen_const_mem (Pmode, new_rtx);
+-	  set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
++	  set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
+ 	}
+       else
+ 	{
+@@ -11947,7 +11958,7 @@ legitimize_pic_address (rtx orig, rtx reg)
+ 	    new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new_rtx);
+ 
+ 	  new_rtx = gen_const_mem (Pmode, new_rtx);
+-	  set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
++	  set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
+ 	}
+ 
+       new_rtx = copy_to_suggested_reg (new_rtx, reg, Pmode);
+@@ -12324,7 +12335,7 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
+       if (pic)
+ 	off = gen_rtx_PLUS (tp_mode, pic, off);
+       off = gen_const_mem (tp_mode, off);
+-      set_mem_alias_set (off, GOT_ALIAS_SET);
++      set_mem_alias_set (off, ix86_GOT_alias_set ());
+ 
+       if (TARGET_64BIT || TARGET_ANY_GNU_TLS)
+ 	{
+-- 
+2.45.2
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-06-27  0:02 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-06-27  0:02 UTC (permalink / raw
  To: gentoo-commits

commit:     7760ff0bf2fd5fa05385fc11158cb7efd7a05cc5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 27 00:02:16 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 27 00:02:16 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7760ff0b

15.0.0: add revert annotation

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

 15.0.0/gentoo/77_all_i386-fix-ix86_expand_move.patch        | 2 ++
 15.0.0/gentoo/78_all_i386-fix-recent-alias-set-change.patch | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/15.0.0/gentoo/77_all_i386-fix-ix86_expand_move.patch b/15.0.0/gentoo/77_all_i386-fix-ix86_expand_move.patch
index 4b42ea9..2b5b8d4 100644
--- a/15.0.0/gentoo/77_all_i386-fix-ix86_expand_move.patch
+++ b/15.0.0/gentoo/77_all_i386-fix-ix86_expand_move.patch
@@ -9,6 +9,8 @@ for non-PECOFF targets, so the else branch would get taken.
 (This is a hack which doesn't work for PECOFF targets but fixes miscompilations
 on ELF.)
 
+This partially reverts commit r15-1599-g63512c72df09b4.
+
 Bug: https://gcc.gnu.org/PR115635
 Bug: https://gcc.gnu.org/PR115661
 ---

diff --git a/15.0.0/gentoo/78_all_i386-fix-recent-alias-set-change.patch b/15.0.0/gentoo/78_all_i386-fix-recent-alias-set-change.patch
index 6776fdd..eb8f5bd 100644
--- a/15.0.0/gentoo/78_all_i386-fix-recent-alias-set-change.patch
+++ b/15.0.0/gentoo/78_all_i386-fix-recent-alias-set-change.patch
@@ -8,6 +8,8 @@ we use -1. Go back to using ix86_GOT_alias_set.
 
 (This is a hack which isn't the cleanest way of fixing it.)
 
+This partially reverts commit r15-1599-g63512c72df09b4.
+
 Bug: https://gcc.gnu.org/PR115635
 Bug: https://gcc.gnu.org/PR115661
 ---


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-06-28 12:49 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-06-28 12:49 UTC (permalink / raw
  To: gentoo-commits

commit:     b97a75814a0b8969a5669c761dde86dc0d9ee2a1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 28 12:49:23 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun 28 12:49:23 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b97a7581

15.0.0: drop x86 backend fixes

Now fixed upstream.

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

 .../gentoo/77_all_i386-fix-ix86_expand_move.patch  | 47 -----------
 .../78_all_i386-fix-recent-alias-set-change.patch  | 97 ----------------------
 2 files changed, 144 deletions(-)

diff --git a/15.0.0/gentoo/77_all_i386-fix-ix86_expand_move.patch b/15.0.0/gentoo/77_all_i386-fix-ix86_expand_move.patch
deleted file mode 100644
index 2b5b8d4..0000000
--- a/15.0.0/gentoo/77_all_i386-fix-ix86_expand_move.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From ec0ead755e65ba51813aa8b66f4eb5574dd8437c Mon Sep 17 00:00:00 2001
-From: Sam James <sam@gentoo.org>
-Date: Wed, 26 Jun 2024 13:19:42 +0100
-Subject: [PATCH 1/2] i386: fix ix86_expand_move
-
-Before r15-1599-g63512c72df09b4, legitimize_pe_coff_symbol would return NULL_RTX
-for non-PECOFF targets, so the else branch would get taken.
-
-(This is a hack which doesn't work for PECOFF targets but fixes miscompilations
-on ELF.)
-
-This partially reverts commit r15-1599-g63512c72df09b4.
-
-Bug: https://gcc.gnu.org/PR115635
-Bug: https://gcc.gnu.org/PR115661
----
- gcc/config/i386/i386-expand.cc | 10 ----------
- 1 file changed, 10 deletions(-)
-
-diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
-index 5dfa7d49f58c..5e0173bc7a84 100644
---- a/gcc/config/i386/i386-expand.cc
-+++ b/gcc/config/i386/i386-expand.cc
-@@ -412,20 +412,10 @@ ix86_expand_move (machine_mode mode, rtx operands[])
- 	}
-       else
- 	{
--#if TARGET_PECOFF
--	  tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
--	  if (tmp)
--	    {
--	      op1 = tmp;
--	      if (!addend)
--		break;
--	    }
--	  else
- 	    {
- 	      op1 = operands[1];
- 	      break;
- 	    }
--#endif
- 	}
- 
-       if (addend)
--- 
-2.45.2
-

diff --git a/15.0.0/gentoo/78_all_i386-fix-recent-alias-set-change.patch b/15.0.0/gentoo/78_all_i386-fix-recent-alias-set-change.patch
deleted file mode 100644
index eb8f5bd..0000000
--- a/15.0.0/gentoo/78_all_i386-fix-recent-alias-set-change.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-From 72a4d2d437782afa975f9b29c3ab4a1826ad0cd6 Mon Sep 17 00:00:00 2001
-From: Sam James <sam@gentoo.org>
-Date: Wed, 26 Jun 2024 12:54:55 +0100
-Subject: [PATCH 2/2] i386: fix recent alias set change
-
-Before r15-1599-g63512c72df09b4, we would create a new alias set, but now
-we use -1. Go back to using ix86_GOT_alias_set.
-
-(This is a hack which isn't the cleanest way of fixing it.)
-
-This partially reverts commit r15-1599-g63512c72df09b4.
-
-Bug: https://gcc.gnu.org/PR115635
-Bug: https://gcc.gnu.org/PR115661
----
- gcc/config/i386/i386-expand.cc |  2 +-
- gcc/config/i386/i386-expand.h  |  1 +
- gcc/config/i386/i386.cc        | 17 ++++++++++++++---
- 3 files changed, 16 insertions(+), 4 deletions(-)
-
-diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
-index 5e0173bc7a84..3345f40ad85d 100644
---- a/gcc/config/i386/i386-expand.cc
-+++ b/gcc/config/i386/i386-expand.cc
-@@ -408,7 +408,7 @@ ix86_expand_move (machine_mode mode, rtx operands[])
- 				 : UNSPEC_GOT));
- 	  op1 = gen_rtx_CONST (Pmode, op1);
- 	  op1 = gen_const_mem (Pmode, op1);
--	  set_mem_alias_set (op1, GOT_ALIAS_SET);
-+	  set_mem_alias_set (op1, ix86_GOT_alias_set ());
- 	}
-       else
- 	{
-diff --git a/gcc/config/i386/i386-expand.h b/gcc/config/i386/i386-expand.h
-index 5e02df1706df..56bee29253ba 100644
---- a/gcc/config/i386/i386-expand.h
-+++ b/gcc/config/i386/i386-expand.h
-@@ -34,6 +34,7 @@ struct expand_vec_perm_d
- };
- 
- rtx legitimize_tls_address (rtx x, enum tls_model model, bool for_mov);
-+alias_set_type ix86_GOT_alias_set (void);
- rtx legitimize_pic_address (rtx orig, rtx reg);
- 
- bool insn_defines_reg (unsigned int regno1, unsigned int regno2,
-diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
-index 1f71ed04be67..62fca080f2f5 100644
---- a/gcc/config/i386/i386.cc
-+++ b/gcc/config/i386/i386.cc
-@@ -11823,6 +11823,17 @@ constant_address_p (rtx x)
- }
- \f
- 
-+/* Return a unique alias set for the GOT.  */
-+
-+alias_set_type
-+ix86_GOT_alias_set (void)
-+{
-+  static alias_set_type set = -1;
-+  if (set == -1)
-+    set = new_alias_set ();
-+  return set;
-+}
-+
- /* Return a legitimate reference for ORIG (an address) using the
-    register REG.  If REG is 0, a new pseudo is generated.
- 
-@@ -11925,7 +11936,7 @@ legitimize_pic_address (rtx orig, rtx reg)
- 				    UNSPEC_GOTPCREL);
- 	  new_rtx = gen_rtx_CONST (Pmode, new_rtx);
- 	  new_rtx = gen_const_mem (Pmode, new_rtx);
--	  set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
-+	  set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
- 	}
-       else
- 	{
-@@ -11947,7 +11958,7 @@ legitimize_pic_address (rtx orig, rtx reg)
- 	    new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new_rtx);
- 
- 	  new_rtx = gen_const_mem (Pmode, new_rtx);
--	  set_mem_alias_set (new_rtx, GOT_ALIAS_SET);
-+	  set_mem_alias_set (new_rtx, ix86_GOT_alias_set ());
- 	}
- 
-       new_rtx = copy_to_suggested_reg (new_rtx, reg, Pmode);
-@@ -12324,7 +12335,7 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov)
-       if (pic)
- 	off = gen_rtx_PLUS (tp_mode, pic, off);
-       off = gen_const_mem (tp_mode, off);
--      set_mem_alias_set (off, GOT_ALIAS_SET);
-+      set_mem_alias_set (off, ix86_GOT_alias_set ());
- 
-       if (TARGET_64BIT || TARGET_ANY_GNU_TLS)
- 	{
--- 
-2.45.2
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-07-14 23:36 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-07-14 23:36 UTC (permalink / raw
  To: gentoo-commits

commit:     f3f27691478a0b256a3b52348bae96f5a6b5f089
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 14 23:35:47 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jul 14 23:35:47 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f3f27691

15.0.0: don't enable -fext-dce with -O2

Bug: https://gcc.gnu.org/PR115876
Bug: https://gcc.gnu.org/PR115877
Bug: https://gcc.gnu.org/PR115912
Bug: https://gcc.gnu.org/PR115916
Bug: https://gcc.gnu.org/PR115927
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...gcc_don-t-enable-fext-dce-with-O2-for-now.patch | 34 ++++++++++++++++++++++
 15.0.0/gentoo/README.history                       |  4 +++
 2 files changed, 38 insertions(+)

diff --git a/15.0.0/gentoo/78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch b/15.0.0/gentoo/78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch
new file mode 100644
index 0000000..82c5535
--- /dev/null
+++ b/15.0.0/gentoo/78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch
@@ -0,0 +1,34 @@
+From 86de2fd7550f75a318aa9819b115487cd850b4fc Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Mon, 15 Jul 2024 00:32:18 +0100
+Subject: [PATCH] gcc: don't enable -fext-dce with -O2 for now
+
+There's too many bugs involving it for now.
+
+    gcc/
+            * opts.cc (default_options_table): Don't enable ext-dce at -O2
+
+Bug: https://gcc.gnu.org/PR115876
+Bug: https://gcc.gnu.org/PR115877
+Bug: https://gcc.gnu.org/PR115912
+Bug: https://gcc.gnu.org/PR115916
+Bug: https://gcc.gnu.org/PR115927
+---
+ gcc/opts.cc | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/gcc/opts.cc b/gcc/opts.cc
+index be90a632338f..e1a1bdf15822 100644
+--- a/gcc/opts.cc
++++ b/gcc/opts.cc
+@@ -634,7 +634,6 @@ static const struct default_options default_options_table[] =
+     { OPT_LEVELS_2_PLUS, OPT_fdevirtualize, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_fdevirtualize_speculatively, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_fexpensive_optimizations, NULL, 1 },
+-    { OPT_LEVELS_2_PLUS, OPT_fext_dce, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_fgcse, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_findirect_inlining, NULL, 1 },
+-- 
+2.45.2
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index efe48af..eddda8f 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+5	15 July 2024
+
+	+ 78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch
+
 4	16 June 2024
 
 	- 77_all_PR115387.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-07-18  0:45 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-07-18  0:45 UTC (permalink / raw
  To: gentoo-commits

commit:     3caa1b3eb3879d24c604ffa282b1c4b2c17fc391
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 18 00:44:35 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jul 18 00:44:35 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=3caa1b3e

15.0.0: update power7 .feature patch

Switch to Peter's version. Can update older branches once it's merged.

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

 .../76_all_ppc_PR97367-power7-cell-altivec.patch   | 102 ++++++++++++++++++++-
 1 file changed, 99 insertions(+), 3 deletions(-)

diff --git a/15.0.0/gentoo/76_all_ppc_PR97367-power7-cell-altivec.patch b/15.0.0/gentoo/76_all_ppc_PR97367-power7-cell-altivec.patch
index 154dd0f..d4ca6c2 100644
--- a/15.0.0/gentoo/76_all_ppc_PR97367-power7-cell-altivec.patch
+++ b/15.0.0/gentoo/76_all_ppc_PR97367-power7-cell-altivec.patch
@@ -1,13 +1,109 @@
 https://gcc.gnu.org/PR97367
-https://inbox.sourceware.org/gcc-patches/20240308.123342.1112119677226246836.rene@exactcode.de/
+https://inbox.sourceware.org/gcc-patches/5f2b5d5e-a682-4084-b70e-89929f4cc6dc@bergner.org/T/#u
+
+From git@z Thu Jan  1 00:00:00 1970
+Subject: [PATCH v2] rs6000: Fix .machine cpu selection w/ altivec [PR97367]
+From: Peter Bergner <pshop@bergner.org>
+Date: Fri, 12 Jul 2024 16:48:29 -0500
+Message-Id: <5f2b5d5e-a682-4084-b70e-89929f4cc6dc@bergner.org>
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+René's patch seems to have stalled, so here is an updated version of the
+patch with the requested changes to his patch.
+
+I'll note I have added an additional code change, which is to also emit a
+".machine altivec" if Altivec is enabled.  The problem this fixes is for
+cpus like the G5, which is basically a power4 plus an Altivec unit, its
+".machine power4" doesn't enable the assembler to recognize Altivec insns.
+That isn't a problem if you use gcc -mcpu=G5 to assemble the assembler file,
+since gcc passes -maltivec to the assembler.  However, if you try to assemble
+the assembler file with as by hand, you'll get "unrecognized opcode" errors.
+I did not do the same for VSX, since all ".machine <cpu>" for cpus that
+support VSX already enable VSX insn recognition, so it's not needed.
+
+
+rs6000: Fix .machine cpu selection w/ altivec [PR97367]
+
+There are various non-IBM CPUs with altivec, so we cannot use that
+flag to determine which .machine cpu to use, so ignore it.
+Emit an additional ".machine altivec" if Altivec is enabled so
+that the assembler doesn't require an explicit -maltivec option
+to assemble any Altivec instructions for those targets where
+the ".machine cpu" is insufficient to enable Altivec.  For example,
+-mcpu=G5 emits a ".machine power4".
+
+This passed bootstrap and regtesting on powrpc64-linux (running the testsuite
+in both 32-bit and 64-bit modes) with no regressions.
+
+Ok for trunk and the release branches after some trunk burn-in time?
+
+Peter
+
+
+2024-07-12  René Rebe  <rene@exactcode.de>
+	    Peter Bergner  <bergner@linux.ibm.com>
+
+gcc/
+	PR target/97367
+	* config/rs6000/rs6000.c (rs6000_machine_from_flags): Do not consider
+	OPTION_MASK_ALTIVEC.
+	(emit_asm_machine): For Altivec compiles, emit a ".machine altivec".
+
+gcc/testsuite/
+	PR target/97367
+	* gcc.target/powerpc/pr97367.c: New test.
+
+Signed-of-by: René Rebe <rene@exactcode.de>
+---
+ gcc/config/rs6000/rs6000.cc                |  5 ++++-
+ gcc/testsuite/gcc.target/powerpc/pr97367.c | 13 +++++++++++++
+ 2 files changed, 17 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/gcc.target/powerpc/pr97367.c
+
+diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
+index 2cbea6ea2d7..2cb8f35739b 100644
 --- a/gcc/config/rs6000/rs6000.cc
 +++ b/gcc/config/rs6000/rs6000.cc
-@@ -5869,7 +5869,7 @@ rs6000_machine_from_flags (void)
+@@ -5888,7 +5888,8 @@ rs6000_machine_from_flags (void)
    HOST_WIDE_INT flags = rs6000_isa_flags;
  
    /* Disable the flags that should never influence the .machine selection.  */
 -  flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ISEL);
-+  flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ALTIVEC | OPTION_MASK_ISEL);
++  flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ISEL
++	     | OPTION_MASK_ALTIVEC);
  
    if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0)
      return "power10";
+@@ -5913,6 +5914,8 @@ void
+ emit_asm_machine (void)
+ {
+   fprintf (asm_out_file, "\t.machine %s\n", rs6000_machine);
++  if (TARGET_ALTIVEC)
++    fprintf (asm_out_file, "\t.machine altivec\n");
+ }
+ #endif
+ 
+diff --git a/gcc/testsuite/gcc.target/powerpc/pr97367.c b/gcc/testsuite/gcc.target/powerpc/pr97367.c
+new file mode 100644
+index 00000000000..f9118dbcdec
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/powerpc/pr97367.c
+@@ -0,0 +1,13 @@
++/* PR target/97367 */
++/* { dg-options "-mdejagnu-cpu=G5" } */
++
++/* Verify we emit a ".machine power4" and ".machine altivec" rather
++   than a ".machine power7".  */
++
++int dummy (void)
++{
++  return 0;
++}
++
++/* { dg-final { scan-assembler {\.\mmachine power4\M} } } */
++/* { dg-final { scan-assembler {\.\mmachine altivec\M} } } */
+-- 
+2.45.2
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-07-19 11:14 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-07-19 11:14 UTC (permalink / raw
  To: gentoo-commits

commit:     3147d1f67ddd03e579d1ff19aea8b9cfeb490564
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 19 11:14:06 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul 19 11:14:06 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=3147d1f6

15.0.0: drop upstream power7 patch

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

 .../76_all_ppc_PR97367-power7-cell-altivec.patch   | 109 ---------------------
 15.0.0/gentoo/README.history                       |   4 +
 2 files changed, 4 insertions(+), 109 deletions(-)

diff --git a/15.0.0/gentoo/76_all_ppc_PR97367-power7-cell-altivec.patch b/15.0.0/gentoo/76_all_ppc_PR97367-power7-cell-altivec.patch
deleted file mode 100644
index d4ca6c2..0000000
--- a/15.0.0/gentoo/76_all_ppc_PR97367-power7-cell-altivec.patch
+++ /dev/null
@@ -1,109 +0,0 @@
-https://gcc.gnu.org/PR97367
-https://inbox.sourceware.org/gcc-patches/5f2b5d5e-a682-4084-b70e-89929f4cc6dc@bergner.org/T/#u
-
-From git@z Thu Jan  1 00:00:00 1970
-Subject: [PATCH v2] rs6000: Fix .machine cpu selection w/ altivec [PR97367]
-From: Peter Bergner <pshop@bergner.org>
-Date: Fri, 12 Jul 2024 16:48:29 -0500
-Message-Id: <5f2b5d5e-a682-4084-b70e-89929f4cc6dc@bergner.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset="utf-8"
-Content-Transfer-Encoding: 8bit
-
-René's patch seems to have stalled, so here is an updated version of the
-patch with the requested changes to his patch.
-
-I'll note I have added an additional code change, which is to also emit a
-".machine altivec" if Altivec is enabled.  The problem this fixes is for
-cpus like the G5, which is basically a power4 plus an Altivec unit, its
-".machine power4" doesn't enable the assembler to recognize Altivec insns.
-That isn't a problem if you use gcc -mcpu=G5 to assemble the assembler file,
-since gcc passes -maltivec to the assembler.  However, if you try to assemble
-the assembler file with as by hand, you'll get "unrecognized opcode" errors.
-I did not do the same for VSX, since all ".machine <cpu>" for cpus that
-support VSX already enable VSX insn recognition, so it's not needed.
-
-
-rs6000: Fix .machine cpu selection w/ altivec [PR97367]
-
-There are various non-IBM CPUs with altivec, so we cannot use that
-flag to determine which .machine cpu to use, so ignore it.
-Emit an additional ".machine altivec" if Altivec is enabled so
-that the assembler doesn't require an explicit -maltivec option
-to assemble any Altivec instructions for those targets where
-the ".machine cpu" is insufficient to enable Altivec.  For example,
--mcpu=G5 emits a ".machine power4".
-
-This passed bootstrap and regtesting on powrpc64-linux (running the testsuite
-in both 32-bit and 64-bit modes) with no regressions.
-
-Ok for trunk and the release branches after some trunk burn-in time?
-
-Peter
-
-
-2024-07-12  René Rebe  <rene@exactcode.de>
-	    Peter Bergner  <bergner@linux.ibm.com>
-
-gcc/
-	PR target/97367
-	* config/rs6000/rs6000.c (rs6000_machine_from_flags): Do not consider
-	OPTION_MASK_ALTIVEC.
-	(emit_asm_machine): For Altivec compiles, emit a ".machine altivec".
-
-gcc/testsuite/
-	PR target/97367
-	* gcc.target/powerpc/pr97367.c: New test.
-
-Signed-of-by: René Rebe <rene@exactcode.de>
----
- gcc/config/rs6000/rs6000.cc                |  5 ++++-
- gcc/testsuite/gcc.target/powerpc/pr97367.c | 13 +++++++++++++
- 2 files changed, 17 insertions(+), 1 deletion(-)
- create mode 100644 gcc/testsuite/gcc.target/powerpc/pr97367.c
-
-diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
-index 2cbea6ea2d7..2cb8f35739b 100644
---- a/gcc/config/rs6000/rs6000.cc
-+++ b/gcc/config/rs6000/rs6000.cc
-@@ -5888,7 +5888,8 @@ rs6000_machine_from_flags (void)
-   HOST_WIDE_INT flags = rs6000_isa_flags;
- 
-   /* Disable the flags that should never influence the .machine selection.  */
--  flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ISEL);
-+  flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ISEL
-+	     | OPTION_MASK_ALTIVEC);
- 
-   if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0)
-     return "power10";
-@@ -5913,6 +5914,8 @@ void
- emit_asm_machine (void)
- {
-   fprintf (asm_out_file, "\t.machine %s\n", rs6000_machine);
-+  if (TARGET_ALTIVEC)
-+    fprintf (asm_out_file, "\t.machine altivec\n");
- }
- #endif
- 
-diff --git a/gcc/testsuite/gcc.target/powerpc/pr97367.c b/gcc/testsuite/gcc.target/powerpc/pr97367.c
-new file mode 100644
-index 00000000000..f9118dbcdec
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/powerpc/pr97367.c
-@@ -0,0 +1,13 @@
-+/* PR target/97367 */
-+/* { dg-options "-mdejagnu-cpu=G5" } */
-+
-+/* Verify we emit a ".machine power4" and ".machine altivec" rather
-+   than a ".machine power7".  */
-+
-+int dummy (void)
-+{
-+  return 0;
-+}
-+
-+/* { dg-final { scan-assembler {\.\mmachine power4\M} } } */
-+/* { dg-final { scan-assembler {\.\mmachine altivec\M} } } */
--- 
-2.45.2
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index eddda8f..e7d8bf0 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+6	?? ???? ????
+
+	- 76_all_ppc_PR97367-power7-cell-altivec.patch
+
 5	15 July 2024
 
 	+ 78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-07-22  1:11 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-07-22  1:11 UTC (permalink / raw
  To: gentoo-commits

commit:     7203178939395f9d01a60a68073ec175ed0236c8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 22 01:11:43 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul 22 01:11:43 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=72031789

15.0.0: cut patchset 6

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index e7d8bf0..81978cb 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-6	?? ???? ????
+6	22 July 2024
 
 	- 76_all_ppc_PR97367-power7-cell-altivec.patch
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-07-28 23:34 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-07-28 23:34 UTC (permalink / raw
  To: gentoo-commits

commit:     4145ebad1e8382c5ec5ca26dadf21437aa37d172
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 28 23:34:10 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jul 28 23:34:10 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=4145ebad

15.0.0: add 79_all_PR116120-revert-match-pattern.patch

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

 .../79_all_PR116120-revert-match-pattern.patch     | 199 +++++++++++++++++++++
 15.0.0/gentoo/README.history                       |   4 +
 2 files changed, 203 insertions(+)

diff --git a/15.0.0/gentoo/79_all_PR116120-revert-match-pattern.patch b/15.0.0/gentoo/79_all_PR116120-revert-match-pattern.patch
new file mode 100644
index 0000000..6d5b542
--- /dev/null
+++ b/15.0.0/gentoo/79_all_PR116120-revert-match-pattern.patch
@@ -0,0 +1,199 @@
+From fd07aecb306c682e1d7255fc01c6c02f3ca4f6f8 Mon Sep 17 00:00:00 2001
+Message-ID: <fd07aecb306c682e1d7255fc01c6c02f3ca4f6f8.1722209590.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Mon, 29 Jul 2024 00:32:52 +0100
+Subject: [PATCH] Revert "MATCH: Simplify (a ? x : y) eq/ne (b ? x : y)
+ [PR111150]"
+
+This reverts commit 44fcc1ca11e7ea35dc9fb25a5317346bc1eaf7b2.
+
+Avoid a reported & debugged miscompilation until it gets fixed.
+
+Bug: https://gcc.gnu.org/PR116120
+---
+ gcc/match.pd                               | 15 -----
+ gcc/testsuite/g++.dg/tree-ssa/pr111150.C   | 34 ----------
+ gcc/testsuite/gcc.dg/tree-ssa/pr111150-1.c | 72 ----------------------
+ gcc/testsuite/gcc.dg/tree-ssa/pr111150.c   | 22 -------
+ 4 files changed, 143 deletions(-)
+ delete mode 100644 gcc/testsuite/g++.dg/tree-ssa/pr111150.C
+ delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr111150-1.c
+ delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr111150.c
+
+diff --git a/gcc/match.pd b/gcc/match.pd
+index 1c8601229e3d..b8d0ebee08db 100644
+--- a/gcc/match.pd
++++ b/gcc/match.pd
+@@ -5632,21 +5632,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
+   (vec_cond (bit_and (bit_not @0) @1) @2 @3)))
+ #endif
+ 
+-/* (a ? x : y) != (b ? x : y) --> (a^b) ? TRUE  : FALSE */
+-/* (a ? x : y) == (b ? x : y) --> (a^b) ? FALSE : TRUE  */
+-/* (a ? x : y) != (b ? y : x) --> (a^b) ? FALSE : TRUE  */
+-/* (a ? x : y) == (b ? y : x) --> (a^b) ? TRUE  : FALSE */
+-(for cnd (cond vec_cond)
+- (for eqne (eq ne)
+-  (simplify
+-   (eqne:c (cnd @0 @1 @2) (cnd @3 @1 @2))
+-    (cnd (bit_xor @0 @3) { constant_boolean_node (eqne == NE_EXPR, type); }
+-     { constant_boolean_node (eqne != NE_EXPR, type); }))
+-  (simplify
+-   (eqne:c (cnd @0 @1 @2) (cnd @3 @2 @1))
+-    (cnd (bit_xor @0 @3) { constant_boolean_node (eqne != NE_EXPR, type); }
+-     { constant_boolean_node (eqne == NE_EXPR, type); }))))
+-
+ /* Canonicalize mask ? { 0, ... } : { -1, ...} to ~mask if the mask
+    types are compatible.  */
+ (simplify
+diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr111150.C b/gcc/testsuite/g++.dg/tree-ssa/pr111150.C
+deleted file mode 100644
+index ac5d3ef15d83..000000000000
+--- a/gcc/testsuite/g++.dg/tree-ssa/pr111150.C
++++ /dev/null
+@@ -1,34 +0,0 @@
+-/* PR tree-optimization/111150 */
+-/* { dg-do compile } */
+-/* { dg-options "-O1 -fdump-tree-forwprop1 -Wno-psabi" } */
+-
+-typedef int v4si __attribute((__vector_size__(4 * sizeof(int))));
+-
+-/* Before the patch, VEC_COND_EXPR was generated for each statement in the
+-   function. This resulted in 3 VEC_COND_EXPR. */
+-v4si f1_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) {
+-  v4si X = a == b ? e : f;
+-  v4si Y = c == d ? e : f;
+-  return (X != Y);
+-}
+-
+-v4si f2_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) {
+-  v4si X = a == b ? e : f;
+-  v4si Y = c == d ? e : f;
+-  return (X == Y);
+-}
+-
+-v4si f3_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) {
+-  v4si X = a == b ? e : f;
+-  v4si Y = c == d ? f : e;
+-  return (X != Y);
+-}
+-
+-v4si f4_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) {
+-  v4si X = a == b ? e : f;
+-  v4si Y = c == d ? f : e;
+-  return (X == Y);
+-}
+-
+-/* For each testcase, should produce only one VEC_COND_EXPR for X^Y. */
+-/* { dg-final { scan-tree-dump-times " VEC_COND_EXPR " 4 "forwprop1" } } */
+diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr111150-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr111150-1.c
+deleted file mode 100644
+index 6f4b21ac6bcb..000000000000
+--- a/gcc/testsuite/gcc.dg/tree-ssa/pr111150-1.c
++++ /dev/null
+@@ -1,72 +0,0 @@
+-/* PR tree-optimization/111150 */
+-/* { dg-do compile } */
+-/* { dg-options "-O1 -fgimple -fdump-tree-forwprop1-raw" } */
+-
+-/* Checks if pattern (X ? e : f) == (Y ? e : f) gets optimized. */
+-__GIMPLE()
+-_Bool f1_(int a, int b, int c, int d, int e, int f) {
+-  _Bool X;
+-  _Bool Y;
+-  _Bool t;
+-  int t1;
+-  int t2;
+-  X = a == b;
+-  Y = c == d;
+-  /* Before the patch cond_expr was generated for these 2 statements. */
+-  t1 = X ? e : f;
+-  t2 = Y ? e : f;
+-  t = t1 == t2;
+-  return t;
+-}
+-
+-/* Checks if pattern (X ? e : f) != (Y ? e : f) gets optimized. */
+-__GIMPLE()
+-_Bool f2_(int a, int b, int c, int d, int e, int f) {
+-  _Bool X;
+-  _Bool Y;
+-  _Bool t;
+-  int t1;
+-  int t2;
+-  X = a == b;
+-  Y = c == d;
+-  t1 = X ? e : f;
+-  t2 = Y ? e : f;
+-  t = t1 != t2;
+-  return t;
+-}
+-
+-/* Checks if pattern (X ? e : f) == (Y ? f : e) gets optimized. */
+-__GIMPLE()
+-_Bool f3_(int a, int b, int c, int d, int e, int f) {
+-  _Bool X;
+-  _Bool Y;
+-  _Bool t;
+-  int t1;
+-  int t2;
+-  X = a == b;
+-  Y = c == d;
+-  t1 = X ? e : f;
+-  t2 = Y ? f : e;
+-  t = t1 == t2;
+-  return t;
+-}
+-
+-/* Checks if pattern (X ? e : f) != (Y ? f : e) gets optimized. */
+-__GIMPLE()
+-_Bool f4_(int a, int b, int c, int d, int e, int f) {
+-  _Bool X;
+-  _Bool Y;
+-  _Bool t;
+-  int t1;
+-  int t2;
+-  X = a == b;
+-  Y = c == d;
+-  t1 = X ? e : f;
+-  t2 = Y ? f : e;
+-  t = t1 != t2;
+-  return t;
+-}
+-
+-/* Should generate one bit_xor_expr for each testcase. */
+-/* { dg-final { scan-tree-dump-not "cond_expr, "  "forwprop1" } } */
+-/* { dg-final { scan-tree-dump-times "bit_xor_expr, " 4 "forwprop1" } } */
+diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr111150.c b/gcc/testsuite/gcc.dg/tree-ssa/pr111150.c
+deleted file mode 100644
+index 568ae9e44b3d..000000000000
+--- a/gcc/testsuite/gcc.dg/tree-ssa/pr111150.c
++++ /dev/null
+@@ -1,22 +0,0 @@
+-/* PR tree-optimization/111150 */
+-/* { dg-do compile } */
+-/* { dg-options "-O1 -fdump-tree-forwprop1 -Wno-psabi" } */
+-
+-typedef int v4si __attribute((__vector_size__(4 * sizeof(int))));
+-
+-/* Before the patch, VEC_COND_EXPR was generated for each statement in the
+-   function. This resulted in 3 VEC_COND_EXPR. */
+-v4si f1_(v4si a, v4si b, v4si c, v4si d) {
+-  v4si X = a == b;
+-  v4si Y = c == d;
+-  return (X != Y);
+-}
+-
+-v4si f2_(v4si a, v4si b, v4si c, v4si d) {
+-  v4si X = a == b;
+-  v4si Y = c == d;
+-  return (X == Y);
+-}
+-
+-/* For each testcase, should produce only one VEC_COND_EXPR for X^Y. */
+-/* { dg-final { scan-tree-dump-times " VEC_COND_EXPR " 2 "forwprop1" } } */
+
+base-commit: d5f1948640815a554d106542c2e91e4e117aa3bc
+-- 
+2.45.2
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 81978cb..93de595 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+7	29 July 2024
+
+	+ 79_all_PR116120-revert-match-pattern.patch
+
 6	22 July 2024
 
 	- 76_all_ppc_PR97367-power7-cell-altivec.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-01 14:40 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-01 14:40 UTC (permalink / raw
  To: gentoo-commits

commit:     26118e917fcb919778bc5634c6cd8072ff23c4f6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  1 14:39:41 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug  1 14:39:41 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=26118e91

15.0.0: drop 79_all_PR116120-revert-match-pattern.patch

Part of it is fixed and the other part should be committed soon.

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

 .../79_all_PR116120-revert-match-pattern.patch     | 199 ---------------------
 15.0.0/gentoo/README.history                       |   4 +
 2 files changed, 4 insertions(+), 199 deletions(-)

diff --git a/15.0.0/gentoo/79_all_PR116120-revert-match-pattern.patch b/15.0.0/gentoo/79_all_PR116120-revert-match-pattern.patch
deleted file mode 100644
index 6d5b542..0000000
--- a/15.0.0/gentoo/79_all_PR116120-revert-match-pattern.patch
+++ /dev/null
@@ -1,199 +0,0 @@
-From fd07aecb306c682e1d7255fc01c6c02f3ca4f6f8 Mon Sep 17 00:00:00 2001
-Message-ID: <fd07aecb306c682e1d7255fc01c6c02f3ca4f6f8.1722209590.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Mon, 29 Jul 2024 00:32:52 +0100
-Subject: [PATCH] Revert "MATCH: Simplify (a ? x : y) eq/ne (b ? x : y)
- [PR111150]"
-
-This reverts commit 44fcc1ca11e7ea35dc9fb25a5317346bc1eaf7b2.
-
-Avoid a reported & debugged miscompilation until it gets fixed.
-
-Bug: https://gcc.gnu.org/PR116120
----
- gcc/match.pd                               | 15 -----
- gcc/testsuite/g++.dg/tree-ssa/pr111150.C   | 34 ----------
- gcc/testsuite/gcc.dg/tree-ssa/pr111150-1.c | 72 ----------------------
- gcc/testsuite/gcc.dg/tree-ssa/pr111150.c   | 22 -------
- 4 files changed, 143 deletions(-)
- delete mode 100644 gcc/testsuite/g++.dg/tree-ssa/pr111150.C
- delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr111150-1.c
- delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr111150.c
-
-diff --git a/gcc/match.pd b/gcc/match.pd
-index 1c8601229e3d..b8d0ebee08db 100644
---- a/gcc/match.pd
-+++ b/gcc/match.pd
-@@ -5632,21 +5632,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
-   (vec_cond (bit_and (bit_not @0) @1) @2 @3)))
- #endif
- 
--/* (a ? x : y) != (b ? x : y) --> (a^b) ? TRUE  : FALSE */
--/* (a ? x : y) == (b ? x : y) --> (a^b) ? FALSE : TRUE  */
--/* (a ? x : y) != (b ? y : x) --> (a^b) ? FALSE : TRUE  */
--/* (a ? x : y) == (b ? y : x) --> (a^b) ? TRUE  : FALSE */
--(for cnd (cond vec_cond)
-- (for eqne (eq ne)
--  (simplify
--   (eqne:c (cnd @0 @1 @2) (cnd @3 @1 @2))
--    (cnd (bit_xor @0 @3) { constant_boolean_node (eqne == NE_EXPR, type); }
--     { constant_boolean_node (eqne != NE_EXPR, type); }))
--  (simplify
--   (eqne:c (cnd @0 @1 @2) (cnd @3 @2 @1))
--    (cnd (bit_xor @0 @3) { constant_boolean_node (eqne != NE_EXPR, type); }
--     { constant_boolean_node (eqne == NE_EXPR, type); }))))
--
- /* Canonicalize mask ? { 0, ... } : { -1, ...} to ~mask if the mask
-    types are compatible.  */
- (simplify
-diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr111150.C b/gcc/testsuite/g++.dg/tree-ssa/pr111150.C
-deleted file mode 100644
-index ac5d3ef15d83..000000000000
---- a/gcc/testsuite/g++.dg/tree-ssa/pr111150.C
-+++ /dev/null
-@@ -1,34 +0,0 @@
--/* PR tree-optimization/111150 */
--/* { dg-do compile } */
--/* { dg-options "-O1 -fdump-tree-forwprop1 -Wno-psabi" } */
--
--typedef int v4si __attribute((__vector_size__(4 * sizeof(int))));
--
--/* Before the patch, VEC_COND_EXPR was generated for each statement in the
--   function. This resulted in 3 VEC_COND_EXPR. */
--v4si f1_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) {
--  v4si X = a == b ? e : f;
--  v4si Y = c == d ? e : f;
--  return (X != Y);
--}
--
--v4si f2_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) {
--  v4si X = a == b ? e : f;
--  v4si Y = c == d ? e : f;
--  return (X == Y);
--}
--
--v4si f3_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) {
--  v4si X = a == b ? e : f;
--  v4si Y = c == d ? f : e;
--  return (X != Y);
--}
--
--v4si f4_(v4si a, v4si b, v4si c, v4si d, v4si e, v4si f) {
--  v4si X = a == b ? e : f;
--  v4si Y = c == d ? f : e;
--  return (X == Y);
--}
--
--/* For each testcase, should produce only one VEC_COND_EXPR for X^Y. */
--/* { dg-final { scan-tree-dump-times " VEC_COND_EXPR " 4 "forwprop1" } } */
-diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr111150-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr111150-1.c
-deleted file mode 100644
-index 6f4b21ac6bcb..000000000000
---- a/gcc/testsuite/gcc.dg/tree-ssa/pr111150-1.c
-+++ /dev/null
-@@ -1,72 +0,0 @@
--/* PR tree-optimization/111150 */
--/* { dg-do compile } */
--/* { dg-options "-O1 -fgimple -fdump-tree-forwprop1-raw" } */
--
--/* Checks if pattern (X ? e : f) == (Y ? e : f) gets optimized. */
--__GIMPLE()
--_Bool f1_(int a, int b, int c, int d, int e, int f) {
--  _Bool X;
--  _Bool Y;
--  _Bool t;
--  int t1;
--  int t2;
--  X = a == b;
--  Y = c == d;
--  /* Before the patch cond_expr was generated for these 2 statements. */
--  t1 = X ? e : f;
--  t2 = Y ? e : f;
--  t = t1 == t2;
--  return t;
--}
--
--/* Checks if pattern (X ? e : f) != (Y ? e : f) gets optimized. */
--__GIMPLE()
--_Bool f2_(int a, int b, int c, int d, int e, int f) {
--  _Bool X;
--  _Bool Y;
--  _Bool t;
--  int t1;
--  int t2;
--  X = a == b;
--  Y = c == d;
--  t1 = X ? e : f;
--  t2 = Y ? e : f;
--  t = t1 != t2;
--  return t;
--}
--
--/* Checks if pattern (X ? e : f) == (Y ? f : e) gets optimized. */
--__GIMPLE()
--_Bool f3_(int a, int b, int c, int d, int e, int f) {
--  _Bool X;
--  _Bool Y;
--  _Bool t;
--  int t1;
--  int t2;
--  X = a == b;
--  Y = c == d;
--  t1 = X ? e : f;
--  t2 = Y ? f : e;
--  t = t1 == t2;
--  return t;
--}
--
--/* Checks if pattern (X ? e : f) != (Y ? f : e) gets optimized. */
--__GIMPLE()
--_Bool f4_(int a, int b, int c, int d, int e, int f) {
--  _Bool X;
--  _Bool Y;
--  _Bool t;
--  int t1;
--  int t2;
--  X = a == b;
--  Y = c == d;
--  t1 = X ? e : f;
--  t2 = Y ? f : e;
--  t = t1 != t2;
--  return t;
--}
--
--/* Should generate one bit_xor_expr for each testcase. */
--/* { dg-final { scan-tree-dump-not "cond_expr, "  "forwprop1" } } */
--/* { dg-final { scan-tree-dump-times "bit_xor_expr, " 4 "forwprop1" } } */
-diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr111150.c b/gcc/testsuite/gcc.dg/tree-ssa/pr111150.c
-deleted file mode 100644
-index 568ae9e44b3d..000000000000
---- a/gcc/testsuite/gcc.dg/tree-ssa/pr111150.c
-+++ /dev/null
-@@ -1,22 +0,0 @@
--/* PR tree-optimization/111150 */
--/* { dg-do compile } */
--/* { dg-options "-O1 -fdump-tree-forwprop1 -Wno-psabi" } */
--
--typedef int v4si __attribute((__vector_size__(4 * sizeof(int))));
--
--/* Before the patch, VEC_COND_EXPR was generated for each statement in the
--   function. This resulted in 3 VEC_COND_EXPR. */
--v4si f1_(v4si a, v4si b, v4si c, v4si d) {
--  v4si X = a == b;
--  v4si Y = c == d;
--  return (X != Y);
--}
--
--v4si f2_(v4si a, v4si b, v4si c, v4si d) {
--  v4si X = a == b;
--  v4si Y = c == d;
--  return (X == Y);
--}
--
--/* For each testcase, should produce only one VEC_COND_EXPR for X^Y. */
--/* { dg-final { scan-tree-dump-times " VEC_COND_EXPR " 2 "forwprop1" } } */
-
-base-commit: d5f1948640815a554d106542c2e91e4e117aa3bc
--- 
-2.45.2
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 93de595..793fd45 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+8	????
+
+	- 79_all_PR116120-revert-match-pattern.patch
+
 7	29 July 2024
 
 	+ 79_all_PR116120-revert-match-pattern.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-02 20:39 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-02 20:39 UTC (permalink / raw
  To: gentoo-commits

commit:     831195db0373e4954ff47452375844caf997e34b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  2 20:39:09 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug  2 20:39:09 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=831195db

15.0.0: add 79_all_Revert-Make-may_trap_p_1-return-false-for-constant-p.patch

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

 ...-may_trap_p_1-return-false-for-constant-p.patch | 98 ++++++++++++++++++++++
 1 file changed, 98 insertions(+)

diff --git a/15.0.0/gentoo/79_all_Revert-Make-may_trap_p_1-return-false-for-constant-p.patch b/15.0.0/gentoo/79_all_Revert-Make-may_trap_p_1-return-false-for-constant-p.patch
new file mode 100644
index 0000000..c65b792
--- /dev/null
+++ b/15.0.0/gentoo/79_all_Revert-Make-may_trap_p_1-return-false-for-constant-p.patch
@@ -0,0 +1,98 @@
+From 4def9ea5a1511d6adbbd15e59f2542326484454a Mon Sep 17 00:00:00 2001
+Message-ID: <4def9ea5a1511d6adbbd15e59f2542326484454a.1722631128.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Fri, 2 Aug 2024 21:38:28 +0100
+Subject: [PATCH] Revert "Make may_trap_p_1 return false for constant pool
+ references [PR116145]"
+
+This reverts commit ba730fd10934e4ca004251aa3748bf9da4d35e62.
+
+Bug: https://gcc.gnu.org/PR116200
+---
+ gcc/rtlanal.cc                                | 14 ++----
+ .../aarch64/sve/acle/general/pr116145.c       | 46 -------------------
+ 2 files changed, 4 insertions(+), 56 deletions(-)
+ delete mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr116145.c
+
+diff --git a/gcc/rtlanal.cc b/gcc/rtlanal.cc
+index 893a6afbbc53..4158a531bdd7 100644
+--- a/gcc/rtlanal.cc
++++ b/gcc/rtlanal.cc
+@@ -3152,16 +3152,10 @@ may_trap_p_1 (const_rtx x, unsigned flags)
+ 	  && MEM_VOLATILE_P (x)
+ 	  && XEXP (x, 0) == stack_pointer_rtx)
+ 	return true;
+-      if (/* MEM_READONLY_P means that the memory is both statically
+-	     allocated and readonly, so MEM_NOTRAP_P should remain true
+-	     even if the memory reference is moved.  This is certainly
+-	     true for the important case of force_const_mem.
+-
+-	     Otherwise, MEM_NOTRAP_P only relates to the actual position
+-	     of the memory reference; moving it out of context such as
+-	     when moving code when optimizing, might cause its address
+-	     to become invalid.  */
+-	  (code_changed && !MEM_READONLY_P (x))
++      if (/* MEM_NOTRAP_P only relates to the actual position of the memory
++	     reference; moving it out of context such as when moving code
++	     when optimizing, might cause its address to become invalid.  */
++	  code_changed
+ 	  || !MEM_NOTRAP_P (x))
+ 	{
+ 	  poly_int64 size = MEM_SIZE_KNOWN_P (x) ? MEM_SIZE (x) : -1;
+diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr116145.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr116145.c
+deleted file mode 100644
+index a3d93d3e1c84..000000000000
+--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr116145.c
++++ /dev/null
+@@ -1,46 +0,0 @@
+-// { dg-options "-O2" }
+-
+-#include <stdlib.h>
+-#include <arm_sve.h>
+-
+-#pragma GCC target "+sve2"
+-
+-typedef unsigned char uchar;
+-
+-const uchar *
+-search_line_fast (const uchar *s, const uchar *end)
+-{
+-  size_t VL = svcntb();
+-  svuint8_t arr1, arr2;
+-  svbool_t pc, pg = svptrue_b8();
+-
+-  // This should not be loaded inside the loop every time.
+-  arr2 = svreinterpret_u8(svdup_u32(0x0a0d5c3f));
+-
+-  for (; s+VL <= end; s += VL) {
+-    arr1 = svld1_u8(pg, s);
+-    pc = svmatch_u8(pg, arr1, arr2);
+-
+-    if (svptest_any(pg, pc)) {
+-      pc = svbrkb_z(pg, pc);
+-      return s+svcntp_b8(pg, pc);
+-    }
+-  }
+-
+-  // Handle remainder.
+-  if (s < end) {
+-    pg = svwhilelt_b8((size_t)s, (size_t)end);
+-
+-    arr1 = svld1_u8(pg, s);
+-    pc = svmatch_u8(pg, arr1, arr2);
+-
+-    if (svptest_any(pg, pc)) {
+-      pc = svbrkb_z(pg, pc);
+-      return s+svcntp_b8(pg, pc);
+-    }
+-  }
+-
+-  return end;
+-}
+-
+-// { dg-final { scan-assembler {:\n\tld1b\t[^\n]*\n\tmatch\t[^\n]*\n\tb\.} } }
+
+base-commit: 5ebfaf2d4994c124ce81aa0abd7eaa1529644749
+-- 
+2.45.2
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-05  1:51 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-05  1:51 UTC (permalink / raw
  To: gentoo-commits

commit:     2723607b796c54089f8004568fa060c476dc829d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  5 01:47:39 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug  5 01:47:39 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=2723607b

15.0.0: cut patchset 8

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

 15.0.0/gentoo/README.history | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 793fd45..2188207 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,6 +1,7 @@
-8	????
+8	5 August 2024
 
 	- 79_all_PR116120-revert-match-pattern.patch
+	+ 79_all_Revert-Make-may_trap_p_1-return-false-for-constant-p.patch
 
 7	29 July 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-05  1:54 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-05  1:54 UTC (permalink / raw
  To: gentoo-commits

commit:     01af1e42d008b379d7046adce4733b4d67acdcf0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  5 01:54:07 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug  5 01:54:07 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=01af1e42

15.0.0: re-enable -fext-dce at -O2

All known issues are fixed, let's get testing it again.

I have let Jeff know I spotted a test is failing on s390x at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115912#c21.

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

 ...gcc_don-t-enable-fext-dce-with-O2-for-now.patch | 34 ----------------------
 15.0.0/gentoo/README.history                       |  4 +++
 2 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/15.0.0/gentoo/78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch b/15.0.0/gentoo/78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch
deleted file mode 100644
index 82c5535..0000000
--- a/15.0.0/gentoo/78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 86de2fd7550f75a318aa9819b115487cd850b4fc Mon Sep 17 00:00:00 2001
-From: Sam James <sam@gentoo.org>
-Date: Mon, 15 Jul 2024 00:32:18 +0100
-Subject: [PATCH] gcc: don't enable -fext-dce with -O2 for now
-
-There's too many bugs involving it for now.
-
-    gcc/
-            * opts.cc (default_options_table): Don't enable ext-dce at -O2
-
-Bug: https://gcc.gnu.org/PR115876
-Bug: https://gcc.gnu.org/PR115877
-Bug: https://gcc.gnu.org/PR115912
-Bug: https://gcc.gnu.org/PR115916
-Bug: https://gcc.gnu.org/PR115927
----
- gcc/opts.cc | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/gcc/opts.cc b/gcc/opts.cc
-index be90a632338f..e1a1bdf15822 100644
---- a/gcc/opts.cc
-+++ b/gcc/opts.cc
-@@ -634,7 +634,6 @@ static const struct default_options default_options_table[] =
-     { OPT_LEVELS_2_PLUS, OPT_fdevirtualize, NULL, 1 },
-     { OPT_LEVELS_2_PLUS, OPT_fdevirtualize_speculatively, NULL, 1 },
-     { OPT_LEVELS_2_PLUS, OPT_fexpensive_optimizations, NULL, 1 },
--    { OPT_LEVELS_2_PLUS, OPT_fext_dce, NULL, 1 },
-     { OPT_LEVELS_2_PLUS, OPT_fgcse, NULL, 1 },
-     { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
-     { OPT_LEVELS_2_PLUS, OPT_findirect_inlining, NULL, 1 },
--- 
-2.45.2
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 2188207..a872a71 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+?	????
+
+	- 78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch
+
 8	5 August 2024
 
 	- 79_all_PR116120-revert-match-pattern.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-05  9:09 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-05  9:09 UTC (permalink / raw
  To: gentoo-commits

commit:     767d91209f8983d23caae12e2337eca6c2b5dbdb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  5 09:09:04 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug  5 09:09:04 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=767d9120

15.0.0: drop 79_all_Revert-Make-may_trap_p_1-return-false-for-constant-p.patch

It's been reverted upstream.

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

 ...-may_trap_p_1-return-false-for-constant-p.patch | 98 ----------------------
 1 file changed, 98 deletions(-)

diff --git a/15.0.0/gentoo/79_all_Revert-Make-may_trap_p_1-return-false-for-constant-p.patch b/15.0.0/gentoo/79_all_Revert-Make-may_trap_p_1-return-false-for-constant-p.patch
deleted file mode 100644
index c65b792..0000000
--- a/15.0.0/gentoo/79_all_Revert-Make-may_trap_p_1-return-false-for-constant-p.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From 4def9ea5a1511d6adbbd15e59f2542326484454a Mon Sep 17 00:00:00 2001
-Message-ID: <4def9ea5a1511d6adbbd15e59f2542326484454a.1722631128.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Fri, 2 Aug 2024 21:38:28 +0100
-Subject: [PATCH] Revert "Make may_trap_p_1 return false for constant pool
- references [PR116145]"
-
-This reverts commit ba730fd10934e4ca004251aa3748bf9da4d35e62.
-
-Bug: https://gcc.gnu.org/PR116200
----
- gcc/rtlanal.cc                                | 14 ++----
- .../aarch64/sve/acle/general/pr116145.c       | 46 -------------------
- 2 files changed, 4 insertions(+), 56 deletions(-)
- delete mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr116145.c
-
-diff --git a/gcc/rtlanal.cc b/gcc/rtlanal.cc
-index 893a6afbbc53..4158a531bdd7 100644
---- a/gcc/rtlanal.cc
-+++ b/gcc/rtlanal.cc
-@@ -3152,16 +3152,10 @@ may_trap_p_1 (const_rtx x, unsigned flags)
- 	  && MEM_VOLATILE_P (x)
- 	  && XEXP (x, 0) == stack_pointer_rtx)
- 	return true;
--      if (/* MEM_READONLY_P means that the memory is both statically
--	     allocated and readonly, so MEM_NOTRAP_P should remain true
--	     even if the memory reference is moved.  This is certainly
--	     true for the important case of force_const_mem.
--
--	     Otherwise, MEM_NOTRAP_P only relates to the actual position
--	     of the memory reference; moving it out of context such as
--	     when moving code when optimizing, might cause its address
--	     to become invalid.  */
--	  (code_changed && !MEM_READONLY_P (x))
-+      if (/* MEM_NOTRAP_P only relates to the actual position of the memory
-+	     reference; moving it out of context such as when moving code
-+	     when optimizing, might cause its address to become invalid.  */
-+	  code_changed
- 	  || !MEM_NOTRAP_P (x))
- 	{
- 	  poly_int64 size = MEM_SIZE_KNOWN_P (x) ? MEM_SIZE (x) : -1;
-diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr116145.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr116145.c
-deleted file mode 100644
-index a3d93d3e1c84..000000000000
---- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr116145.c
-+++ /dev/null
-@@ -1,46 +0,0 @@
--// { dg-options "-O2" }
--
--#include <stdlib.h>
--#include <arm_sve.h>
--
--#pragma GCC target "+sve2"
--
--typedef unsigned char uchar;
--
--const uchar *
--search_line_fast (const uchar *s, const uchar *end)
--{
--  size_t VL = svcntb();
--  svuint8_t arr1, arr2;
--  svbool_t pc, pg = svptrue_b8();
--
--  // This should not be loaded inside the loop every time.
--  arr2 = svreinterpret_u8(svdup_u32(0x0a0d5c3f));
--
--  for (; s+VL <= end; s += VL) {
--    arr1 = svld1_u8(pg, s);
--    pc = svmatch_u8(pg, arr1, arr2);
--
--    if (svptest_any(pg, pc)) {
--      pc = svbrkb_z(pg, pc);
--      return s+svcntp_b8(pg, pc);
--    }
--  }
--
--  // Handle remainder.
--  if (s < end) {
--    pg = svwhilelt_b8((size_t)s, (size_t)end);
--
--    arr1 = svld1_u8(pg, s);
--    pc = svmatch_u8(pg, arr1, arr2);
--
--    if (svptest_any(pg, pc)) {
--      pc = svbrkb_z(pg, pc);
--      return s+svcntp_b8(pg, pc);
--    }
--  }
--
--  return end;
--}
--
--// { dg-final { scan-assembler {:\n\tld1b\t[^\n]*\n\tmatch\t[^\n]*\n\tb\.} } }
-
-base-commit: 5ebfaf2d4994c124ce81aa0abd7eaa1529644749
--- 
-2.45.2
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-08 11:03 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-08 11:03 UTC (permalink / raw
  To: gentoo-commits

commit:     66b7838fff9640206291c609dd07b2bc95c9f128
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  8 11:03:19 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug  8 11:03:19 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=66b7838f

15.0.0: add 31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch

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

 ...ortran-pass-Wcomplain-wrong-lang-where-ap.patch | 104 +++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/15.0.0/gentoo/31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch b/15.0.0/gentoo/31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch
new file mode 100644
index 0000000..0bf9812
--- /dev/null
+++ b/15.0.0/gentoo/31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch
@@ -0,0 +1,104 @@
+From 1e216be94b87d607cafd6f35fd2ece5ba5004a76 Mon Sep 17 00:00:00 2001
+Message-ID: <1e216be94b87d607cafd6f35fd2ece5ba5004a76.1723114981.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Thu, 8 Aug 2024 12:00:41 +0100
+Subject: [PATCH] testsuite: fortran: pass -Wcomplain-wrong-lang where
+ appropriate
+
+These tests expect the diagnostic from -Wcomplain-wrong-lang but
+don't explicitly enable it. This causes issues if running the testsuite
+with -Wno-complain-wrong-lang.
+
+gcc/testsuite/ChangeLog:
+        * gfortran.dg/ISO_Fortran_binding_17.f90: Pass -Wcomplain-wrong-lang.
+        * gfortran.dg/c-interop/allocate-errors.f90: Likewise.
+        * gfortran.dg/c-interop/establish-errors.f90: Likewise.
+        * gfortran.dg/c-interop/section-errors.f90: Likewise.
+        * gfortran.dg/c-interop/select-errors.f90: Likewise.
+        * gfortran.dg/c-interop/setpointer-errors.f90: Likewise.
+---
+ gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90      | 2 +-
+ gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90   | 2 +-
+ gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90  | 2 +-
+ gcc/testsuite/gfortran.dg/c-interop/section-errors.f90    | 2 +-
+ gcc/testsuite/gfortran.dg/c-interop/select-errors.f90     | 2 +-
+ gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90 | 2 +-
+ 6 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90 b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90
+index c399e710ce97..c321c7a61f54 100644
+--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90
++++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.f90
+@@ -1,6 +1,6 @@
+ ! { dg-do run }
+ ! { dg-additional-sources ISO_Fortran_binding_17.c }
+-! { dg-options "-fcheck=all" }
++! { dg-options "-Wcomplain-wrong-lang -fcheck=all" }
+ ! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 }
+ !
+ ! PR fortran/92470
+diff --git a/gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90
+index a58d05a33681..1cf3fbd9fdd7 100644
+--- a/gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90
++++ b/gcc/testsuite/gfortran.dg/c-interop/allocate-errors.f90
+@@ -1,6 +1,6 @@
+ ! { dg-do run }
+ ! { dg-additional-sources "allocate-errors-c.c dump-descriptors.c" }
+-! { dg-additional-options "-Wno-error -fcheck=all" }
++! { dg-additional-options "-Wno-error -Wcomplain-wrong-lang -fcheck=all" }
+ ! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 }
+ !
+ ! This program tests that the CFI_allocate and CFI_deallocate functions
+diff --git a/gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90
+index 307a2664b743..c505c1904c75 100644
+--- a/gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90
++++ b/gcc/testsuite/gfortran.dg/c-interop/establish-errors.f90
+@@ -1,7 +1,7 @@
+ ! PR101317
+ ! { dg-do run }
+ ! { dg-additional-sources "establish-errors-c.c dump-descriptors.c" }
+-! { dg-additional-options "-Wno-error -fcheck=all" }
++! { dg-additional-options "-Wno-error -Wcomplain-wrong-lang -fcheck=all" }
+ ! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 }
+ !
+ ! This program tests that the CFI_establish function properly detects
+diff --git a/gcc/testsuite/gfortran.dg/c-interop/section-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/section-errors.f90
+index 28328b799b30..699fa8940849 100644
+--- a/gcc/testsuite/gfortran.dg/c-interop/section-errors.f90
++++ b/gcc/testsuite/gfortran.dg/c-interop/section-errors.f90
+@@ -1,6 +1,6 @@
+ ! { dg-do run }
+ ! { dg-additional-sources "section-errors-c.c dump-descriptors.c" }
+-! { dg-additional-options "-Wno-error -fcheck=all" }
++! { dg-additional-options "-Wno-error -Wcomplain-wrong-lang -fcheck=all" }
+ ! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 }
+ !
+ ! This program tests that the CFI_section function properly detects
+diff --git a/gcc/testsuite/gfortran.dg/c-interop/select-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/select-errors.f90
+index b719c9e68679..199f314ed359 100644
+--- a/gcc/testsuite/gfortran.dg/c-interop/select-errors.f90
++++ b/gcc/testsuite/gfortran.dg/c-interop/select-errors.f90
+@@ -1,6 +1,6 @@
+ ! { dg-do run }
+ ! { dg-additional-sources "select-errors-c.c dump-descriptors.c" }
+-! { dg-additional-options "-Wno-error -fcheck=all" }
++! { dg-additional-options "-Wno-error -Wcomplain-wrong-lang -fcheck=all" }
+ ! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 }
+ !
+ ! This program tests that the CFI_select_part function properly detects
+diff --git a/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90 b/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90
+index 84a01ce16b12..3af7cc7f0e0f 100644
+--- a/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90
++++ b/gcc/testsuite/gfortran.dg/c-interop/setpointer-errors.f90
+@@ -1,7 +1,7 @@
+ ! PR 101317
+ ! { dg-do run }
+ ! { dg-additional-sources "setpointer-errors-c.c dump-descriptors.c" }
+-! { dg-additional-options "-Wno-error -fcheck=all" }
++! { dg-additional-options "-Wno-error -Wcomplain-wrong-lang -fcheck=all" }
+ ! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 }
+ !
+ ! This program tests that the CFI_setpointer function properly detects
+-- 
+2.45.2
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-08 11:06 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-08 11:06 UTC (permalink / raw
  To: gentoo-commits

commit:     bf4ef4b5f40ababd682716570dd5683d154844ca
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  8 11:06:47 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug  8 11:06:47 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bf4ef4b5

15.0.0: add link to upstream discussion/question wrt tests

https://inbox.sourceware.org/gcc-patches/87v80cn24t.fsf <AT> gentoo.org/

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

 .../31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch   | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/15.0.0/gentoo/31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch b/15.0.0/gentoo/31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch
index 0bf9812..89e5a8b 100644
--- a/15.0.0/gentoo/31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch
+++ b/15.0.0/gentoo/31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch
@@ -1,3 +1,5 @@
+https://inbox.sourceware.org/gcc-patches/87v80cn24t.fsf@gentoo.org/
+
 From 1e216be94b87d607cafd6f35fd2ece5ba5004a76 Mon Sep 17 00:00:00 2001
 Message-ID: <1e216be94b87d607cafd6f35fd2ece5ba5004a76.1723114981.git.sam@gentoo.org>
 From: Sam James <sam@gentoo.org>


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-08 11:10 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-08 11:10 UTC (permalink / raw
  To: gentoo-commits

commit:     a8f25dda00d49c9a43b19d64fface4a570d6af07
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  8 11:09:50 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug  8 11:09:50 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=a8f25dda

15.0.0: add commit ref to eclass change too to patch

See d4c98533530d9478391b0593fd84cf37ac9c97cb.

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

 .../31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch   | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/15.0.0/gentoo/31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch b/15.0.0/gentoo/31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch
index 89e5a8b..ba6d67f 100644
--- a/15.0.0/gentoo/31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch
+++ b/15.0.0/gentoo/31_all_testsuite-fortran-pass-Wcomplain-wrong-lang-where-ap.patch
@@ -1,5 +1,7 @@
 https://inbox.sourceware.org/gcc-patches/87v80cn24t.fsf@gentoo.org/
 
+See also d4c98533530d9478391b0593fd84cf37ac9c97cb in ::gentoo.
+
 From 1e216be94b87d607cafd6f35fd2ece5ba5004a76 Mon Sep 17 00:00:00 2001
 Message-ID: <1e216be94b87d607cafd6f35fd2ece5ba5004a76.1723114981.git.sam@gentoo.org>
 From: Sam James <sam@gentoo.org>


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-09 19:25 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-09 19:25 UTC (permalink / raw
  To: gentoo-commits

commit:     3dcc61086076d7c86d43dbad5961fadf1b944d72
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  9 19:24:37 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug  9 19:24:37 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=3dcc6108

15.0.0: add revert of LRA patch

See https://inbox.sourceware.org/gcc-patches/CA+=Sn1=_jL5P1Nbx4b7O-wYttpMsP4N545nk49rXntKnoJ7G-Q <AT> mail.gmail.com/.

It breaks arm64 bootstrap at least.

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

 ...emit-caller-save-register-spills-before-c.patch | 101 +++++++++++++++++++++
 15.0.0/gentoo/README.history                       |   1 +
 2 files changed, 102 insertions(+)

diff --git a/15.0.0/gentoo/32_all_Revert-lra-emit-caller-save-register-spills-before-c.patch b/15.0.0/gentoo/32_all_Revert-lra-emit-caller-save-register-spills-before-c.patch
new file mode 100644
index 0000000..6cd1b43
--- /dev/null
+++ b/15.0.0/gentoo/32_all_Revert-lra-emit-caller-save-register-spills-before-c.patch
@@ -0,0 +1,101 @@
+From c67cc1d712f488a93d03dcfcda70e82250e13ab9 Mon Sep 17 00:00:00 2001
+Message-ID: <c67cc1d712f488a93d03dcfcda70e82250e13ab9.1723231445.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Fri, 9 Aug 2024 20:24:00 +0100
+Subject: [PATCH] Revert "lra: emit caller-save register spills before call
+ insn [PR116028]"
+
+This reverts commit 3c67a0fa1dd39a3378deb854a7fef0ff7fe38004.
+
+See https://inbox.sourceware.org/gcc-patches/CA+=Sn1=_jL5P1Nbx4b7O-wYttpMsP4N545nk49rXntKnoJ7G-Q@mail.gmail.com/.
+---
+ gcc/lra-constraints.cc                       | 28 +++-----------------
+ gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c |  2 +-
+ gcc/testsuite/gcc.dg/pr10474.c               |  2 +-
+ 3 files changed, 6 insertions(+), 26 deletions(-)
+
+diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
+index 28c1a877c003..92b343fa99a0 100644
+--- a/gcc/lra-constraints.cc
++++ b/gcc/lra-constraints.cc
+@@ -152,9 +152,6 @@ static machine_mode curr_operand_mode[MAX_RECOG_OPERANDS];
+    (e.g. constant) and whose subreg is given operand of the current
+    insn.  VOIDmode in all other cases.  */
+ static machine_mode original_subreg_reg_mode[MAX_RECOG_OPERANDS];
+-/* The nearest call insn for an insn on which split transformation
+-   will be done. The call insn is in the same EBB as the insn.  */
+-static rtx_insn *latest_call_insn;
+ 
+ \f
+ 
+@@ -6289,25 +6286,10 @@ split_reg (bool before_p, int original_regno, rtx_insn *insn,
+ 			 after_p ? restore : NULL,
+ 			 call_save_p
+ 			 ?  "Add reg<-save" : "Add reg<-split");
+-  if (call_save_p && latest_call_insn != NULL)
+-    /* PR116028: If original_regno is a pseudo that has been assigned a
+-       call-save hard register, then emit the spill insn before the call
+-       insn 'latest_call_insn' instead of adjacent to 'insn'. If 'insn'
+-       and 'latest_call_insn' belong to the same EBB but to two separate
+-       BBs, and if 'insn' is present in the entry BB, then generating the
+-       spill insn in the entry BB can prevent shrink wrap from happening.
+-       This is because the spill insn references the stack pointer and
+-       hence the prolog gets generated in the entry BB itself. It is
+-       also more efficient to generate the spill before
+-       'latest_call_insn' as the spill now occurs only in the path
+-       containing the call.  */
+-    lra_process_new_insns (PREV_INSN (latest_call_insn), NULL, save,
+-			   "Add save<-reg");
+-  else
+-    lra_process_new_insns (insn, before_p ? save : NULL,
+-			   before_p ? NULL : save,
+-			   call_save_p
+-			   ?  "Add save<-reg" : "Add split<-reg");
++  lra_process_new_insns (insn, before_p ? save : NULL,
++			 before_p ? NULL : save,
++			 call_save_p
++			 ?  "Add save<-reg" : "Add split<-reg");
+   if (nregs > 1 || original_regno < FIRST_PSEUDO_REGISTER)
+     /* If we are trying to split multi-register.  We should check
+        conflicts on the next assignment sub-pass.  IRA can allocate on
+@@ -6791,7 +6773,6 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail)
+   last_processed_bb = NULL;
+   CLEAR_HARD_REG_SET (potential_reload_hard_regs);
+   live_hard_regs = eliminable_regset | lra_no_alloc_regs;
+-  latest_call_insn = NULL;
+   /* We don't process new insns generated in the loop.	*/
+   for (curr_insn = tail; curr_insn != PREV_INSN (head); curr_insn = prev_insn)
+     {
+@@ -7004,7 +6985,6 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail)
+ 	      last_call_for_abi[callee_abi.id ()] = calls_num;
+ 	      full_and_partial_call_clobbers
+ 		|= callee_abi.full_and_partial_reg_clobbers ();
+-	      latest_call_insn = curr_insn;
+ 	      if ((cheap = find_reg_note (curr_insn,
+ 					  REG_RETURNED, NULL_RTX)) != NULL_RTX
+ 		  && ((cheap = XEXP (cheap, 0)), true)
+diff --git a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c
+index 8c150972f952..a95637abbe54 100644
+--- a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c
++++ b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c
+@@ -26,4 +26,4 @@ bar (long a)
+ 
+ /* { dg-final { scan-rtl-dump "Will split live ranges of parameters" "ira" } } */
+ /* { dg-final { scan-rtl-dump "Split live-range of register" "ira" { xfail { ! aarch64*-*-* } } } } */
+-/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" } } */
++/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" { xfail powerpc*-*-* } } } */
+diff --git a/gcc/testsuite/gcc.dg/pr10474.c b/gcc/testsuite/gcc.dg/pr10474.c
+index b5393d5b6e3e..a4af536ec284 100644
+--- a/gcc/testsuite/gcc.dg/pr10474.c
++++ b/gcc/testsuite/gcc.dg/pr10474.c
+@@ -13,4 +13,4 @@ void f(int *i)
+ }
+ 
+ /* XFAIL due to PR70681.  */ 
+-/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue"  { xfail arm*-*-* } } } */
++/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue"  { xfail arm*-*-* powerpc*-*-* } } } */
+
+base-commit: 9e4da946c4263a4c89d5fc365b3c97ae244c5018
+-- 
+2.45.2
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index a872a71..3c55551 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,6 +1,7 @@
 ?	????
 
 	- 78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch
+	+ 32_all_Revert-lra-emit-caller-save-register-spills-before-c.patch
 
 8	5 August 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-09 19:47 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-09 19:47 UTC (permalink / raw
  To: gentoo-commits

commit:     b1db6e989802fb46fb5d242f68e3edbc0f0b2cd0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  9 19:46:45 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug  9 19:46:45 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b1db6e98

15.0.0: drop LRA revert

It's now reverted upstream.

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

 ...emit-caller-save-register-spills-before-c.patch | 101 ---------------------
 1 file changed, 101 deletions(-)

diff --git a/15.0.0/gentoo/32_all_Revert-lra-emit-caller-save-register-spills-before-c.patch b/15.0.0/gentoo/32_all_Revert-lra-emit-caller-save-register-spills-before-c.patch
deleted file mode 100644
index 6cd1b43..0000000
--- a/15.0.0/gentoo/32_all_Revert-lra-emit-caller-save-register-spills-before-c.patch
+++ /dev/null
@@ -1,101 +0,0 @@
-From c67cc1d712f488a93d03dcfcda70e82250e13ab9 Mon Sep 17 00:00:00 2001
-Message-ID: <c67cc1d712f488a93d03dcfcda70e82250e13ab9.1723231445.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Fri, 9 Aug 2024 20:24:00 +0100
-Subject: [PATCH] Revert "lra: emit caller-save register spills before call
- insn [PR116028]"
-
-This reverts commit 3c67a0fa1dd39a3378deb854a7fef0ff7fe38004.
-
-See https://inbox.sourceware.org/gcc-patches/CA+=Sn1=_jL5P1Nbx4b7O-wYttpMsP4N545nk49rXntKnoJ7G-Q@mail.gmail.com/.
----
- gcc/lra-constraints.cc                       | 28 +++-----------------
- gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c |  2 +-
- gcc/testsuite/gcc.dg/pr10474.c               |  2 +-
- 3 files changed, 6 insertions(+), 26 deletions(-)
-
-diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
-index 28c1a877c003..92b343fa99a0 100644
---- a/gcc/lra-constraints.cc
-+++ b/gcc/lra-constraints.cc
-@@ -152,9 +152,6 @@ static machine_mode curr_operand_mode[MAX_RECOG_OPERANDS];
-    (e.g. constant) and whose subreg is given operand of the current
-    insn.  VOIDmode in all other cases.  */
- static machine_mode original_subreg_reg_mode[MAX_RECOG_OPERANDS];
--/* The nearest call insn for an insn on which split transformation
--   will be done. The call insn is in the same EBB as the insn.  */
--static rtx_insn *latest_call_insn;
- 
- \f
- 
-@@ -6289,25 +6286,10 @@ split_reg (bool before_p, int original_regno, rtx_insn *insn,
- 			 after_p ? restore : NULL,
- 			 call_save_p
- 			 ?  "Add reg<-save" : "Add reg<-split");
--  if (call_save_p && latest_call_insn != NULL)
--    /* PR116028: If original_regno is a pseudo that has been assigned a
--       call-save hard register, then emit the spill insn before the call
--       insn 'latest_call_insn' instead of adjacent to 'insn'. If 'insn'
--       and 'latest_call_insn' belong to the same EBB but to two separate
--       BBs, and if 'insn' is present in the entry BB, then generating the
--       spill insn in the entry BB can prevent shrink wrap from happening.
--       This is because the spill insn references the stack pointer and
--       hence the prolog gets generated in the entry BB itself. It is
--       also more efficient to generate the spill before
--       'latest_call_insn' as the spill now occurs only in the path
--       containing the call.  */
--    lra_process_new_insns (PREV_INSN (latest_call_insn), NULL, save,
--			   "Add save<-reg");
--  else
--    lra_process_new_insns (insn, before_p ? save : NULL,
--			   before_p ? NULL : save,
--			   call_save_p
--			   ?  "Add save<-reg" : "Add split<-reg");
-+  lra_process_new_insns (insn, before_p ? save : NULL,
-+			 before_p ? NULL : save,
-+			 call_save_p
-+			 ?  "Add save<-reg" : "Add split<-reg");
-   if (nregs > 1 || original_regno < FIRST_PSEUDO_REGISTER)
-     /* If we are trying to split multi-register.  We should check
-        conflicts on the next assignment sub-pass.  IRA can allocate on
-@@ -6791,7 +6773,6 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail)
-   last_processed_bb = NULL;
-   CLEAR_HARD_REG_SET (potential_reload_hard_regs);
-   live_hard_regs = eliminable_regset | lra_no_alloc_regs;
--  latest_call_insn = NULL;
-   /* We don't process new insns generated in the loop.	*/
-   for (curr_insn = tail; curr_insn != PREV_INSN (head); curr_insn = prev_insn)
-     {
-@@ -7004,7 +6985,6 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail)
- 	      last_call_for_abi[callee_abi.id ()] = calls_num;
- 	      full_and_partial_call_clobbers
- 		|= callee_abi.full_and_partial_reg_clobbers ();
--	      latest_call_insn = curr_insn;
- 	      if ((cheap = find_reg_note (curr_insn,
- 					  REG_RETURNED, NULL_RTX)) != NULL_RTX
- 		  && ((cheap = XEXP (cheap, 0)), true)
-diff --git a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c
-index 8c150972f952..a95637abbe54 100644
---- a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c
-+++ b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c
-@@ -26,4 +26,4 @@ bar (long a)
- 
- /* { dg-final { scan-rtl-dump "Will split live ranges of parameters" "ira" } } */
- /* { dg-final { scan-rtl-dump "Split live-range of register" "ira" { xfail { ! aarch64*-*-* } } } } */
--/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" } } */
-+/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" { xfail powerpc*-*-* } } } */
-diff --git a/gcc/testsuite/gcc.dg/pr10474.c b/gcc/testsuite/gcc.dg/pr10474.c
-index b5393d5b6e3e..a4af536ec284 100644
---- a/gcc/testsuite/gcc.dg/pr10474.c
-+++ b/gcc/testsuite/gcc.dg/pr10474.c
-@@ -13,4 +13,4 @@ void f(int *i)
- }
- 
- /* XFAIL due to PR70681.  */ 
--/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue"  { xfail arm*-*-* } } } */
-+/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue"  { xfail arm*-*-* powerpc*-*-* } } } */
-
-base-commit: 9e4da946c4263a4c89d5fc365b3c97ae244c5018
--- 
-2.45.2
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-09 19:54 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-09 19:54 UTC (permalink / raw
  To: gentoo-commits

commit:     5a1f790fc4c95258c646243a30ba7adcecebcdcc
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  9 19:52:56 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug  9 19:52:56 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5a1f790f

15.0.0: drop obsolete asprintf patch

Fixed upstream by r10-14-g6b3a5e8a3d18c8 and r6-1038-gf50f17e6707da0.

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

 15.0.0/gentoo/07_all_libiberty-asprintf.patch | 18 ------------------
 15.0.0/gentoo/README.history                  |  2 +-
 2 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/15.0.0/gentoo/07_all_libiberty-asprintf.patch b/15.0.0/gentoo/07_all_libiberty-asprintf.patch
deleted file mode 100644
index 1ed2ba3..0000000
--- a/15.0.0/gentoo/07_all_libiberty-asprintf.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-2008-07-25  Magnus Granberg  <zorry@ume.nu>
-
-	* include/libiberty.h (asprintf): Don't declare if defined as a macro
-
---- a/include/libiberty.h
-+++ b/include/libiberty.h
-@@ -652,8 +652,11 @@ extern void *bsearch_r (const void *, const void *,
- /* Like sprintf but provides a pointer to malloc'd storage, which must
-    be freed by the caller.  */
- 
-+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL.  */
-+#ifndef asprintf
- extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
- #endif
-+#endif
- 
- /* Like asprintf but allocates memory without fail. This works like
-    xmalloc.  */

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 3c55551..3d561ee 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,7 +1,7 @@
 ?	????
 
+	- 07_all_libiberty-asprintf.patch
 	- 78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch
-	+ 32_all_Revert-lra-emit-caller-save-register-spills-before-c.patch
 
 8	5 August 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-09 19:54 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-09 19:54 UTC (permalink / raw
  To: gentoo-commits

commit:     ecc3ba06c22edee6b22d2e8e5e05031d18fa372a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  9 19:54:09 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug  9 19:54:22 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ecc3ba06

15.0.0: fix comment in 04_all_nossp-on-nostdlib.patch

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

 15.0.0/gentoo/04_all_nossp-on-nostdlib.patch | 3 ++-
 15.0.0/gentoo/README.history                 | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/04_all_nossp-on-nostdlib.patch b/15.0.0/gentoo/04_all_nossp-on-nostdlib.patch
index 30c5825..e17b6a3 100644
--- a/15.0.0/gentoo/04_all_nossp-on-nostdlib.patch
+++ b/15.0.0/gentoo/04_all_nossp-on-nostdlib.patch
@@ -1,4 +1,5 @@
-│Disable ssp on -nostdlib, -nodefaultlibs and -ffreestanding
+Disable ssp on -nostdlib, -nodefaultlibs and -ffreestanding
+
 https://bugs.gentoo.org/484714
 --- a/gcc/gcc.cc
 +++ b/gcc/gcc.cc

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 3d561ee..4b1d9e8 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,5 +1,6 @@
 ?	????
 
+	U 04_all_nossp-on-nostdlib.patch
 	- 07_all_libiberty-asprintf.patch
 	- 78_all_gcc_don-t-enable-fext-dce-with-O2-for-now.patch
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-11 22:40 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-11 22:40 UTC (permalink / raw
  To: gentoo-commits

commit:     743578d0de067c87f590c9886f14961bb429c1f4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 11 22:40:21 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Aug 11 22:40:21 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=743578d0

15.0.0: cut patchset 9

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 4b1d9e8..468a873 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-?	????
+9	11 August 2024
 
 	U 04_all_nossp-on-nostdlib.patch
 	- 07_all_libiberty-asprintf.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-14  2:57 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-14  2:57 UTC (permalink / raw
  To: gentoo-commits

commit:     70f5adef33e0620d934fc7fb0822e592e3ff04a1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 14 02:57:02 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug 14 02:57:02 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=70f5adef

15.0.0: add 32_all_genoutput-speedup.patch

Link: https://inbox.sourceware.org/gcc-patches/20240814021909.37082-1-cooper.qu <AT> linux.alibaba.com/
Signed-off-by: Sam James <sam <AT> gentoo.org>

 15.0.0/gentoo/32_all_genoutput-speedup.patch | 247 +++++++++++++++++++++++++++
 15.0.0/gentoo/README.history                 |   4 +
 2 files changed, 251 insertions(+)

diff --git a/15.0.0/gentoo/32_all_genoutput-speedup.patch b/15.0.0/gentoo/32_all_genoutput-speedup.patch
new file mode 100644
index 0000000..a379bf8
--- /dev/null
+++ b/15.0.0/gentoo/32_all_genoutput-speedup.patch
@@ -0,0 +1,247 @@
+https://inbox.sourceware.org/gcc-patches/20240814021909.37082-1-cooper.qu@linux.alibaba.com/
+
+From 23ea354ab6c1faf858120b65a0114c5d0bbeaf6e Mon Sep 17 00:00:00 2001
+Message-ID: <23ea354ab6c1faf858120b65a0114c5d0bbeaf6e.1723604026.git.sam@gentoo.org>
+From: Xianmiao Qu <cooper.qu@linux.alibaba.com>
+Date: Wed, 14 Aug 2024 10:19:09 +0800
+Subject: [PATCH] genoutput: Accelerate the place_operands function.
+
+With the increase in the number of modes and patterns for some
+backend architectures, the place_operands function becomes a
+bottleneck int the speed of genoutput, and may even become a
+bottleneck int the overall speed of building the GCC project.
+This patch aims to accelerate the place_operands function,
+the optimizations it includes are:
+1. Use a hash table to store operand information,
+   improving the lookup time for the first operand.
+2. Move mode comparison to the beginning to avoid the scenarios of most strcmp.
+
+I tested the speed improvements for the following backends,
+	Improvement Ratio
+x86_64	197.9%
+aarch64	954.5%
+riscv	2578.6%
+If the build machine is slow, then this improvement can save a lot of time.
+
+I tested the genoutput output for x86_64/aarch64/riscv backends,
+and there was no difference compared to before the optimization,
+so this shouldn't introduce any functional issues.
+
+gcc/
+	* genoutput.cc (struct operand_data): Add member 'eq_next' to
+	point to the next member with the same hash value in the
+	hash table.
+	(compare_operands): Move the comparison of the mode to the very
+	beginning to accelerate the comparison of the two operands.
+	(struct operand_data_hasher): New, a class that takes into account
+	the necessary elements for comparing the equality of two operands
+	in its hash value.
+	(operand_data_hasher::hash): New.
+	(operand_data_hasher::equal): New.
+	(operand_datas): New, hash table of konwn pattern operands.
+	(place_operands): Use a hash table instead of traversing the array
+	to find the same operand.
+	(main): Add initialization of the hash table 'operand_datas'.
+---
+ gcc/genoutput.cc | 111 +++++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 88 insertions(+), 23 deletions(-)
+
+diff --git a/gcc/genoutput.cc b/gcc/genoutput.cc
+index efd81766bb5b..16fd811b5dd5 100644
+--- a/gcc/genoutput.cc
++++ b/gcc/genoutput.cc
+@@ -91,6 +91,7 @@ along with GCC; see the file COPYING3.  If not see
+ #include "errors.h"
+ #include "read-md.h"
+ #include "gensupport.h"
++#include "hash-table.h"
+ 
+ /* No instruction can have more operands than this.  Sorry for this
+    arbitrary limit, but what machine will have an instruction with
+@@ -112,6 +113,8 @@ static int next_operand_number = 1;
+ struct operand_data
+ {
+   struct operand_data *next;
++  /* Point to the next member with the same hash value in the hash table.  */
++  struct operand_data *eq_next;
+   int index;
+   const char *predicate;
+   const char *constraint;
+@@ -127,7 +130,7 @@ struct operand_data
+ 
+ static struct operand_data null_operand =
+ {
+-  0, 0, "", "", E_VOIDmode, 0, 0, 0, 0, 0
++  0, 0, 0, "", "", E_VOIDmode, 0, 0, 0, 0, 0
+ };
+ 
+ static struct operand_data *odata = &null_operand;
+@@ -174,8 +177,8 @@ static void output_operand_data (void);
+ static void output_insn_data (void);
+ static void output_get_insn_name (void);
+ static void scan_operands (class data *, rtx, int, int);
+-static int compare_operands (struct operand_data *,
+-			     struct operand_data *);
++static int compare_operands (const struct operand_data *,
++			     const struct operand_data *);
+ static void place_operands (class data *);
+ static void process_template (class data *, const char *);
+ static void validate_insn_alternatives (class data *);
+@@ -528,10 +531,18 @@ scan_operands (class data *d, rtx part, int this_address_p,
+ /* Compare two operands for content equality.  */
+ 
+ static int
+-compare_operands (struct operand_data *d0, struct operand_data *d1)
++compare_operands (const struct operand_data *d0,
++		  const struct operand_data *d1)
+ {
+   const char *p0, *p1;
+ 
++  /* On one hand, comparing strings for predicate and constraint
++     is time-consuming, and on the other hand, the probability of
++     different modes is relatively high. Therefore, checking the mode
++     first can speed up the execution of the program.  */
++  if (d0->mode != d1->mode)
++    return 0;
++
+   p0 = d0->predicate;
+   if (!p0)
+     p0 = "";
+@@ -550,9 +561,6 @@ compare_operands (struct operand_data *d0, struct operand_data *d1)
+   if (strcmp (p0, p1) != 0)
+     return 0;
+ 
+-  if (d0->mode != d1->mode)
+-    return 0;
+-
+   if (d0->strict_low != d1->strict_low)
+     return 0;
+ 
+@@ -562,6 +570,46 @@ compare_operands (struct operand_data *d0, struct operand_data *d1)
+   return 1;
+ }
+ 
++/* This is a class that takes into account the necessary elements for
++   comparing the equality of two operands in its hash value.  */
++struct operand_data_hasher : nofree_ptr_hash <operand_data>
++{
++  static inline hashval_t hash (const operand_data *);
++  static inline bool equal (const operand_data *, const operand_data *);
++};
++
++hashval_t
++operand_data_hasher::hash (const operand_data * op_info)
++{
++  inchash::hash h;
++  const char *pred, *cons;
++
++  pred = op_info->predicate;
++  if (!pred)
++    pred = "";
++  h.add (pred, strlen (pred) + 1);
++
++  cons = op_info->constraint;
++  if (!cons)
++    cons = "";
++  h.add (cons, strlen (cons) + 1);
++
++  h.add_object (op_info->mode);
++  h.add_object (op_info->strict_low);
++  h.add_object (op_info->eliminable);
++  return h.end ();
++}
++
++bool
++operand_data_hasher::equal (const operand_data * op_info1,
++			    const operand_data * op_info2)
++{
++  return compare_operands (op_info1, op_info2);
++}
++
++/* Hashtable of konwn pattern operands.  */
++static hash_table<operand_data_hasher> *operand_datas;
++
+ /* Scan the list of operands we've already committed to output and either
+    find a subsequence that is the same, or allocate a new one at the end.  */
+ 
+@@ -569,6 +617,7 @@ static void
+ place_operands (class data *d)
+ {
+   struct operand_data *od, *od2;
++  struct operand_data **slot;
+   int i;
+ 
+   if (d->n_operands == 0)
+@@ -577,23 +626,24 @@ place_operands (class data *d)
+       return;
+     }
+ 
++  od = operand_datas->find (&d->operand[0]);
+   /* Brute force substring search.  */
+-  for (od = odata, i = 0; od; od = od->next, i = 0)
+-    if (compare_operands (od, &d->operand[0]))
+-      {
+-	od2 = od->next;
+-	i = 1;
+-	while (1)
+-	  {
+-	    if (i == d->n_operands)
+-	      goto full_match;
+-	    if (od2 == NULL)
+-	      goto partial_match;
+-	    if (! compare_operands (od2, &d->operand[i]))
+-	      break;
+-	    ++i, od2 = od2->next;
+-	  }
+-      }
++  for (; od; od = od->eq_next)
++    {
++      od2 = od->next;
++      i = 1;
++      while (1)
++	{
++	  if (i == d->n_operands)
++	    goto full_match;
++	  if (od2 == NULL)
++	    goto partial_match;
++	  if (! compare_operands (od2, &d->operand[i]))
++	    break;
++	  ++i, od2 = od2->next;
++	}
++    }
++  i = 0;
+ 
+   /* Either partial match at the end of the list, or no match.  In either
+      case, we tack on what operands are remaining to the end of the list.  */
+@@ -605,6 +655,20 @@ place_operands (class data *d)
+       *odata_end = od2;
+       odata_end = &od2->next;
+       od2->index = next_operand_number++;
++      /* Insert the operand_data variable OD2 into the hash table.
++	 If a variable with the same hash value already exists in
++	 the hash table, insert the element at the end of the
++	 linked list connected through the eq_next member.  */
++      slot = operand_datas->find_slot (od2, INSERT);
++      if (*slot)
++	{
++	  struct operand_data *last = (struct operand_data *) *slot;
++	  while (last->eq_next)
++	    last = last->eq_next;
++	  last->eq_next = od2;
++	}
++      else
++	*slot = od2;
+     }
+   *odata_end = NULL;
+   return;
+@@ -1049,6 +1113,7 @@ main (int argc, const char **argv)
+   progname = "genoutput";
+ 
+   init_insn_for_nothing ();
++  operand_datas = new hash_table<operand_data_hasher> (1024);
+ 
+   if (!init_rtx_reader_args (argc, argv))
+     return (FATAL_EXIT_CODE);
+-- 
+2.45.2
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 468a873..1849089 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+10	????
+
+	+ 32_all_genoutput-speedup.patch
+
 9	11 August 2024
 
 	U 04_all_nossp-on-nostdlib.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-14  9:48 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-14  9:48 UTC (permalink / raw
  To: gentoo-commits

commit:     b16c59c4a4df5f65d486023aedc4c5c7deef4f15
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 14 09:48:15 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug 14 09:48:15 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b16c59c4

15.0.0: drop now-upstream 32_all_genoutput-speedup.patch

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

 15.0.0/gentoo/32_all_genoutput-speedup.patch | 247 ---------------------------
 1 file changed, 247 deletions(-)

diff --git a/15.0.0/gentoo/32_all_genoutput-speedup.patch b/15.0.0/gentoo/32_all_genoutput-speedup.patch
deleted file mode 100644
index a379bf8..0000000
--- a/15.0.0/gentoo/32_all_genoutput-speedup.patch
+++ /dev/null
@@ -1,247 +0,0 @@
-https://inbox.sourceware.org/gcc-patches/20240814021909.37082-1-cooper.qu@linux.alibaba.com/
-
-From 23ea354ab6c1faf858120b65a0114c5d0bbeaf6e Mon Sep 17 00:00:00 2001
-Message-ID: <23ea354ab6c1faf858120b65a0114c5d0bbeaf6e.1723604026.git.sam@gentoo.org>
-From: Xianmiao Qu <cooper.qu@linux.alibaba.com>
-Date: Wed, 14 Aug 2024 10:19:09 +0800
-Subject: [PATCH] genoutput: Accelerate the place_operands function.
-
-With the increase in the number of modes and patterns for some
-backend architectures, the place_operands function becomes a
-bottleneck int the speed of genoutput, and may even become a
-bottleneck int the overall speed of building the GCC project.
-This patch aims to accelerate the place_operands function,
-the optimizations it includes are:
-1. Use a hash table to store operand information,
-   improving the lookup time for the first operand.
-2. Move mode comparison to the beginning to avoid the scenarios of most strcmp.
-
-I tested the speed improvements for the following backends,
-	Improvement Ratio
-x86_64	197.9%
-aarch64	954.5%
-riscv	2578.6%
-If the build machine is slow, then this improvement can save a lot of time.
-
-I tested the genoutput output for x86_64/aarch64/riscv backends,
-and there was no difference compared to before the optimization,
-so this shouldn't introduce any functional issues.
-
-gcc/
-	* genoutput.cc (struct operand_data): Add member 'eq_next' to
-	point to the next member with the same hash value in the
-	hash table.
-	(compare_operands): Move the comparison of the mode to the very
-	beginning to accelerate the comparison of the two operands.
-	(struct operand_data_hasher): New, a class that takes into account
-	the necessary elements for comparing the equality of two operands
-	in its hash value.
-	(operand_data_hasher::hash): New.
-	(operand_data_hasher::equal): New.
-	(operand_datas): New, hash table of konwn pattern operands.
-	(place_operands): Use a hash table instead of traversing the array
-	to find the same operand.
-	(main): Add initialization of the hash table 'operand_datas'.
----
- gcc/genoutput.cc | 111 +++++++++++++++++++++++++++++++++++++----------
- 1 file changed, 88 insertions(+), 23 deletions(-)
-
-diff --git a/gcc/genoutput.cc b/gcc/genoutput.cc
-index efd81766bb5b..16fd811b5dd5 100644
---- a/gcc/genoutput.cc
-+++ b/gcc/genoutput.cc
-@@ -91,6 +91,7 @@ along with GCC; see the file COPYING3.  If not see
- #include "errors.h"
- #include "read-md.h"
- #include "gensupport.h"
-+#include "hash-table.h"
- 
- /* No instruction can have more operands than this.  Sorry for this
-    arbitrary limit, but what machine will have an instruction with
-@@ -112,6 +113,8 @@ static int next_operand_number = 1;
- struct operand_data
- {
-   struct operand_data *next;
-+  /* Point to the next member with the same hash value in the hash table.  */
-+  struct operand_data *eq_next;
-   int index;
-   const char *predicate;
-   const char *constraint;
-@@ -127,7 +130,7 @@ struct operand_data
- 
- static struct operand_data null_operand =
- {
--  0, 0, "", "", E_VOIDmode, 0, 0, 0, 0, 0
-+  0, 0, 0, "", "", E_VOIDmode, 0, 0, 0, 0, 0
- };
- 
- static struct operand_data *odata = &null_operand;
-@@ -174,8 +177,8 @@ static void output_operand_data (void);
- static void output_insn_data (void);
- static void output_get_insn_name (void);
- static void scan_operands (class data *, rtx, int, int);
--static int compare_operands (struct operand_data *,
--			     struct operand_data *);
-+static int compare_operands (const struct operand_data *,
-+			     const struct operand_data *);
- static void place_operands (class data *);
- static void process_template (class data *, const char *);
- static void validate_insn_alternatives (class data *);
-@@ -528,10 +531,18 @@ scan_operands (class data *d, rtx part, int this_address_p,
- /* Compare two operands for content equality.  */
- 
- static int
--compare_operands (struct operand_data *d0, struct operand_data *d1)
-+compare_operands (const struct operand_data *d0,
-+		  const struct operand_data *d1)
- {
-   const char *p0, *p1;
- 
-+  /* On one hand, comparing strings for predicate and constraint
-+     is time-consuming, and on the other hand, the probability of
-+     different modes is relatively high. Therefore, checking the mode
-+     first can speed up the execution of the program.  */
-+  if (d0->mode != d1->mode)
-+    return 0;
-+
-   p0 = d0->predicate;
-   if (!p0)
-     p0 = "";
-@@ -550,9 +561,6 @@ compare_operands (struct operand_data *d0, struct operand_data *d1)
-   if (strcmp (p0, p1) != 0)
-     return 0;
- 
--  if (d0->mode != d1->mode)
--    return 0;
--
-   if (d0->strict_low != d1->strict_low)
-     return 0;
- 
-@@ -562,6 +570,46 @@ compare_operands (struct operand_data *d0, struct operand_data *d1)
-   return 1;
- }
- 
-+/* This is a class that takes into account the necessary elements for
-+   comparing the equality of two operands in its hash value.  */
-+struct operand_data_hasher : nofree_ptr_hash <operand_data>
-+{
-+  static inline hashval_t hash (const operand_data *);
-+  static inline bool equal (const operand_data *, const operand_data *);
-+};
-+
-+hashval_t
-+operand_data_hasher::hash (const operand_data * op_info)
-+{
-+  inchash::hash h;
-+  const char *pred, *cons;
-+
-+  pred = op_info->predicate;
-+  if (!pred)
-+    pred = "";
-+  h.add (pred, strlen (pred) + 1);
-+
-+  cons = op_info->constraint;
-+  if (!cons)
-+    cons = "";
-+  h.add (cons, strlen (cons) + 1);
-+
-+  h.add_object (op_info->mode);
-+  h.add_object (op_info->strict_low);
-+  h.add_object (op_info->eliminable);
-+  return h.end ();
-+}
-+
-+bool
-+operand_data_hasher::equal (const operand_data * op_info1,
-+			    const operand_data * op_info2)
-+{
-+  return compare_operands (op_info1, op_info2);
-+}
-+
-+/* Hashtable of konwn pattern operands.  */
-+static hash_table<operand_data_hasher> *operand_datas;
-+
- /* Scan the list of operands we've already committed to output and either
-    find a subsequence that is the same, or allocate a new one at the end.  */
- 
-@@ -569,6 +617,7 @@ static void
- place_operands (class data *d)
- {
-   struct operand_data *od, *od2;
-+  struct operand_data **slot;
-   int i;
- 
-   if (d->n_operands == 0)
-@@ -577,23 +626,24 @@ place_operands (class data *d)
-       return;
-     }
- 
-+  od = operand_datas->find (&d->operand[0]);
-   /* Brute force substring search.  */
--  for (od = odata, i = 0; od; od = od->next, i = 0)
--    if (compare_operands (od, &d->operand[0]))
--      {
--	od2 = od->next;
--	i = 1;
--	while (1)
--	  {
--	    if (i == d->n_operands)
--	      goto full_match;
--	    if (od2 == NULL)
--	      goto partial_match;
--	    if (! compare_operands (od2, &d->operand[i]))
--	      break;
--	    ++i, od2 = od2->next;
--	  }
--      }
-+  for (; od; od = od->eq_next)
-+    {
-+      od2 = od->next;
-+      i = 1;
-+      while (1)
-+	{
-+	  if (i == d->n_operands)
-+	    goto full_match;
-+	  if (od2 == NULL)
-+	    goto partial_match;
-+	  if (! compare_operands (od2, &d->operand[i]))
-+	    break;
-+	  ++i, od2 = od2->next;
-+	}
-+    }
-+  i = 0;
- 
-   /* Either partial match at the end of the list, or no match.  In either
-      case, we tack on what operands are remaining to the end of the list.  */
-@@ -605,6 +655,20 @@ place_operands (class data *d)
-       *odata_end = od2;
-       odata_end = &od2->next;
-       od2->index = next_operand_number++;
-+      /* Insert the operand_data variable OD2 into the hash table.
-+	 If a variable with the same hash value already exists in
-+	 the hash table, insert the element at the end of the
-+	 linked list connected through the eq_next member.  */
-+      slot = operand_datas->find_slot (od2, INSERT);
-+      if (*slot)
-+	{
-+	  struct operand_data *last = (struct operand_data *) *slot;
-+	  while (last->eq_next)
-+	    last = last->eq_next;
-+	  last->eq_next = od2;
-+	}
-+      else
-+	*slot = od2;
-     }
-   *odata_end = NULL;
-   return;
-@@ -1049,6 +1113,7 @@ main (int argc, const char **argv)
-   progname = "genoutput";
- 
-   init_insn_for_nothing ();
-+  operand_datas = new hash_table<operand_data_hasher> (1024);
- 
-   if (!init_rtx_reader_args (argc, argv))
-     return (FATAL_EXIT_CODE);
--- 
-2.45.2
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-19 18:43 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-19 18:43 UTC (permalink / raw
  To: gentoo-commits

commit:     b151680d1549ca7429f970c87b7c11987a351527
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 19 18:42:11 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 19 18:42:11 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b151680d

15.0.0: pull in phiopt fixes

Bug: https://bugs.gentoo.org/938203
Bug: https://bugs.gentoo.org/938200
Bug: https://bugs.gentoo.org/938199
Bug: https://bugs.gentoo.org/938198
Bug: https://bugs.gentoo.org/938196
Bug: https://bugs.gentoo.org/938194
Bug: https://bugs.gentoo.org/938193
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-for-non-const-functions-for-factor_out_c.patch | 100 +++++++++++++++++++++
 ...ct-non-gimple-val-inside-factor_out_condi.patch |  64 +++++++++++++
 15.0.0/gentoo/README.history                       |   5 +-
 3 files changed, 167 insertions(+), 2 deletions(-)

diff --git a/15.0.0/gentoo/32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch b/15.0.0/gentoo/32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch
new file mode 100644
index 0000000..1920001
--- /dev/null
+++ b/15.0.0/gentoo/32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch
@@ -0,0 +1,100 @@
+From 8d5c584e088109e39402221f59c2330b24bed142 Mon Sep 17 00:00:00 2001
+Message-ID: <8d5c584e088109e39402221f59c2330b24bed142.1724092858.git.sam@gentoo.org>
+From: Andrew Pinski <quic_apinski@quicinc.com>
+Date: Mon, 19 Aug 2024 11:37:13 -0700
+Subject: [PATCH 1/2] phi-opt: Fix for non-const functions for
+ factor_out_conditional_operation [PR 116409]
+
+Currently maybe_push_res_to_seq does not handle non-const builtins (it does handle internal
+functions though). So we need to disable factoring out non-const builtins. This will be fixed in
+a better way later but this fixes the regression at hand and does not change what was goal on
+moving factor_out_conditional_operation over to use gimple_match_op.
+
+Bootstrapped and tested on x86_64-linux-gnu with no regressions.
+
+	PR  tree-optimization/116409
+
+gcc/ChangeLog:
+
+	* tree-ssa-phiopt.cc (factor_out_conditional_operation): Reject
+	non const builtins (except for internal functions).
+
+gcc/testsuite/ChangeLog:
+
+	* gcc.dg/torture/pr116409-1.c: New test.
+	* gcc.dg/torture/pr116409-2.c: New test.
+
+Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
+---
+ gcc/testsuite/gcc.dg/torture/pr116409-1.c |  7 +++++++
+ gcc/testsuite/gcc.dg/torture/pr116409-2.c |  7 +++++++
+ gcc/tree-ssa-phiopt.cc                    | 18 ++++++++++++++++++
+ 3 files changed, 32 insertions(+)
+ create mode 100644 gcc/testsuite/gcc.dg/torture/pr116409-1.c
+ create mode 100644 gcc/testsuite/gcc.dg/torture/pr116409-2.c
+
+diff --git a/gcc/testsuite/gcc.dg/torture/pr116409-1.c b/gcc/testsuite/gcc.dg/torture/pr116409-1.c
+new file mode 100644
+index 000000000000..7bf8d49c9a01
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/torture/pr116409-1.c
+@@ -0,0 +1,7 @@
++/* { dg-do compile } */
++/* { dg-additional-options "-frounding-math -fno-math-errno" } */
++double f(int c, double a, double b) {
++  if (c)
++    return __builtin_sqrt(a);
++  return __builtin_sqrt(b);
++}
+diff --git a/gcc/testsuite/gcc.dg/torture/pr116409-2.c b/gcc/testsuite/gcc.dg/torture/pr116409-2.c
+new file mode 100644
+index 000000000000..c27f11312d98
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/torture/pr116409-2.c
+@@ -0,0 +1,7 @@
++/* { dg-do compile } */
++
++int f (int t, char *a, char *b) {
++  if (t)
++    return __builtin_strlen (a);
++  return __builtin_strlen (b);
++}
+diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
+index 2d4aba5b0872..770f3629fe1d 100644
+--- a/gcc/tree-ssa-phiopt.cc
++++ b/gcc/tree-ssa-phiopt.cc
+@@ -54,6 +54,7 @@ along with GCC; see the file COPYING3.  If not see
+ #include "dbgcnt.h"
+ #include "tree-ssa-propagate.h"
+ #include "tree-ssa-dce.h"
++#include "calls.h"
+ 
+ /* Return the singleton PHI in the SEQ of PHIs for edges E0 and E1. */
+ 
+@@ -367,6 +368,23 @@ factor_out_conditional_operation (edge e0, edge e1, gphi *phi,
+   if (!types_compatible_p (TREE_TYPE (new_arg0), TREE_TYPE (new_arg1)))
+     return NULL;
+ 
++  /* Function calls can only be const or an internal function
++     as maybe_push_res_to_seq only handles those currently.  */
++  if (!arg0_op.code.is_tree_code ())
++    {
++      auto fn = combined_fn (arg0_op.code);
++      if (!internal_fn_p (fn))
++	{
++	  tree decl = builtin_decl_implicit (as_builtin_fn (fn));
++	  if (!decl)
++	    return NULL;
++
++	  /* Non-const functions are not supported currently.  */
++	  if (!(flags_from_decl_or_type (decl) & ECF_CONST))
++	    return NULL;
++	}
++    }
++
+   /* Create a new PHI stmt.  */
+   result = PHI_RESULT (phi);
+   temp = make_ssa_name (TREE_TYPE (new_arg0), NULL);
+-- 
+2.46.0
+

diff --git a/15.0.0/gentoo/33_all_phiopt-Reject-non-gimple-val-inside-factor_out_condi.patch b/15.0.0/gentoo/33_all_phiopt-Reject-non-gimple-val-inside-factor_out_condi.patch
new file mode 100644
index 0000000..b3f96ae
--- /dev/null
+++ b/15.0.0/gentoo/33_all_phiopt-Reject-non-gimple-val-inside-factor_out_condi.patch
@@ -0,0 +1,64 @@
+From 555a5e896480884c3fe2c6c117654a798b8ffd3f Mon Sep 17 00:00:00 2001
+Message-ID: <555a5e896480884c3fe2c6c117654a798b8ffd3f.1724092858.git.sam@gentoo.org>
+In-Reply-To: <8d5c584e088109e39402221f59c2330b24bed142.1724092858.git.sam@gentoo.org>
+References: <8d5c584e088109e39402221f59c2330b24bed142.1724092858.git.sam@gentoo.org>
+From: Andrew Pinski <quic_apinski@quicinc.com>
+Date: Mon, 19 Aug 2024 11:37:14 -0700
+Subject: [PATCH 2/2] phiopt: Reject non gimple val inside
+ factor_out_conditional_operation [PR116412]
+
+After the conversion to use maybe_push_res_to_seq, sometimes (REALPART_EXPR
+and IMAGPART_EXPR and VCE) the argument will not be a gimple value and
+then phiopt here would create an invalid PHI.
+Just add a check for gimple val is the way to fix this.
+
+Bootstrapped and tested on x86_64-linux-gnu.
+
+	PR tree-optimization/116412
+
+gcc/ChangeLog:
+
+	* tree-ssa-phiopt.cc (factor_out_conditional_operation): Make sure new_arg0
+	and new_arg1 are both gimple values.
+
+gcc/testsuite/ChangeLog:
+
+	* gcc.dg/torture/pr116412-1.c: New test.
+
+Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
+---
+ gcc/testsuite/gcc.dg/torture/pr116412-1.c | 6 ++++++
+ gcc/tree-ssa-phiopt.cc                    | 4 ++++
+ 2 files changed, 10 insertions(+)
+ create mode 100644 gcc/testsuite/gcc.dg/torture/pr116412-1.c
+
+diff --git a/gcc/testsuite/gcc.dg/torture/pr116412-1.c b/gcc/testsuite/gcc.dg/torture/pr116412-1.c
+new file mode 100644
+index 000000000000..3bc26ecd8b83
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/torture/pr116412-1.c
+@@ -0,0 +1,6 @@
++/* { dg-do compile } */
++double f(_Complex double a, _Complex double *b, int c)
++{
++  if (c) return __real__ a;
++  return __real__ *b;
++}
+diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
+index 770f3629fe1d..be95798a065b 100644
+--- a/gcc/tree-ssa-phiopt.cc
++++ b/gcc/tree-ssa-phiopt.cc
+@@ -368,6 +368,10 @@ factor_out_conditional_operation (edge e0, edge e1, gphi *phi,
+   if (!types_compatible_p (TREE_TYPE (new_arg0), TREE_TYPE (new_arg1)))
+     return NULL;
+ 
++  /* The new args need to be both gimple values. */
++  if (!is_gimple_val (new_arg0) || !is_gimple_val (new_arg1))
++    return NULL;
++
+   /* Function calls can only be const or an internal function
+      as maybe_push_res_to_seq only handles those currently.  */
+   if (!arg0_op.code.is_tree_code ())
+-- 
+2.46.0
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 1849089..0c430eb 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,6 +1,7 @@
-10	????
+10	19 August 2024
 
-	+ 32_all_genoutput-speedup.patch
+	+ 32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch
+	+ 33_all_phiopt-Reject-non-gimple-val-inside-factor_out_condi.patch
 
 9	11 August 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-20 20:31 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-20 20:31 UTC (permalink / raw
  To: gentoo-commits

commit:     c9cf4331e4dfb52d6752adf48c161060fe6ef00a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 20 20:30:42 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 20 20:30:42 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c9cf4331

15.0.0: drop now-upstream phiopt patches

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

 ...-for-non-const-functions-for-factor_out_c.patch | 100 ---------------------
 ...ct-non-gimple-val-inside-factor_out_condi.patch |  64 -------------
 15.0.0/gentoo/README.history                       |   5 ++
 3 files changed, 5 insertions(+), 164 deletions(-)

diff --git a/15.0.0/gentoo/32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch b/15.0.0/gentoo/32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch
deleted file mode 100644
index 1920001..0000000
--- a/15.0.0/gentoo/32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-From 8d5c584e088109e39402221f59c2330b24bed142 Mon Sep 17 00:00:00 2001
-Message-ID: <8d5c584e088109e39402221f59c2330b24bed142.1724092858.git.sam@gentoo.org>
-From: Andrew Pinski <quic_apinski@quicinc.com>
-Date: Mon, 19 Aug 2024 11:37:13 -0700
-Subject: [PATCH 1/2] phi-opt: Fix for non-const functions for
- factor_out_conditional_operation [PR 116409]
-
-Currently maybe_push_res_to_seq does not handle non-const builtins (it does handle internal
-functions though). So we need to disable factoring out non-const builtins. This will be fixed in
-a better way later but this fixes the regression at hand and does not change what was goal on
-moving factor_out_conditional_operation over to use gimple_match_op.
-
-Bootstrapped and tested on x86_64-linux-gnu with no regressions.
-
-	PR  tree-optimization/116409
-
-gcc/ChangeLog:
-
-	* tree-ssa-phiopt.cc (factor_out_conditional_operation): Reject
-	non const builtins (except for internal functions).
-
-gcc/testsuite/ChangeLog:
-
-	* gcc.dg/torture/pr116409-1.c: New test.
-	* gcc.dg/torture/pr116409-2.c: New test.
-
-Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
----
- gcc/testsuite/gcc.dg/torture/pr116409-1.c |  7 +++++++
- gcc/testsuite/gcc.dg/torture/pr116409-2.c |  7 +++++++
- gcc/tree-ssa-phiopt.cc                    | 18 ++++++++++++++++++
- 3 files changed, 32 insertions(+)
- create mode 100644 gcc/testsuite/gcc.dg/torture/pr116409-1.c
- create mode 100644 gcc/testsuite/gcc.dg/torture/pr116409-2.c
-
-diff --git a/gcc/testsuite/gcc.dg/torture/pr116409-1.c b/gcc/testsuite/gcc.dg/torture/pr116409-1.c
-new file mode 100644
-index 000000000000..7bf8d49c9a01
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/torture/pr116409-1.c
-@@ -0,0 +1,7 @@
-+/* { dg-do compile } */
-+/* { dg-additional-options "-frounding-math -fno-math-errno" } */
-+double f(int c, double a, double b) {
-+  if (c)
-+    return __builtin_sqrt(a);
-+  return __builtin_sqrt(b);
-+}
-diff --git a/gcc/testsuite/gcc.dg/torture/pr116409-2.c b/gcc/testsuite/gcc.dg/torture/pr116409-2.c
-new file mode 100644
-index 000000000000..c27f11312d98
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/torture/pr116409-2.c
-@@ -0,0 +1,7 @@
-+/* { dg-do compile } */
-+
-+int f (int t, char *a, char *b) {
-+  if (t)
-+    return __builtin_strlen (a);
-+  return __builtin_strlen (b);
-+}
-diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
-index 2d4aba5b0872..770f3629fe1d 100644
---- a/gcc/tree-ssa-phiopt.cc
-+++ b/gcc/tree-ssa-phiopt.cc
-@@ -54,6 +54,7 @@ along with GCC; see the file COPYING3.  If not see
- #include "dbgcnt.h"
- #include "tree-ssa-propagate.h"
- #include "tree-ssa-dce.h"
-+#include "calls.h"
- 
- /* Return the singleton PHI in the SEQ of PHIs for edges E0 and E1. */
- 
-@@ -367,6 +368,23 @@ factor_out_conditional_operation (edge e0, edge e1, gphi *phi,
-   if (!types_compatible_p (TREE_TYPE (new_arg0), TREE_TYPE (new_arg1)))
-     return NULL;
- 
-+  /* Function calls can only be const or an internal function
-+     as maybe_push_res_to_seq only handles those currently.  */
-+  if (!arg0_op.code.is_tree_code ())
-+    {
-+      auto fn = combined_fn (arg0_op.code);
-+      if (!internal_fn_p (fn))
-+	{
-+	  tree decl = builtin_decl_implicit (as_builtin_fn (fn));
-+	  if (!decl)
-+	    return NULL;
-+
-+	  /* Non-const functions are not supported currently.  */
-+	  if (!(flags_from_decl_or_type (decl) & ECF_CONST))
-+	    return NULL;
-+	}
-+    }
-+
-   /* Create a new PHI stmt.  */
-   result = PHI_RESULT (phi);
-   temp = make_ssa_name (TREE_TYPE (new_arg0), NULL);
--- 
-2.46.0
-

diff --git a/15.0.0/gentoo/33_all_phiopt-Reject-non-gimple-val-inside-factor_out_condi.patch b/15.0.0/gentoo/33_all_phiopt-Reject-non-gimple-val-inside-factor_out_condi.patch
deleted file mode 100644
index b3f96ae..0000000
--- a/15.0.0/gentoo/33_all_phiopt-Reject-non-gimple-val-inside-factor_out_condi.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From 555a5e896480884c3fe2c6c117654a798b8ffd3f Mon Sep 17 00:00:00 2001
-Message-ID: <555a5e896480884c3fe2c6c117654a798b8ffd3f.1724092858.git.sam@gentoo.org>
-In-Reply-To: <8d5c584e088109e39402221f59c2330b24bed142.1724092858.git.sam@gentoo.org>
-References: <8d5c584e088109e39402221f59c2330b24bed142.1724092858.git.sam@gentoo.org>
-From: Andrew Pinski <quic_apinski@quicinc.com>
-Date: Mon, 19 Aug 2024 11:37:14 -0700
-Subject: [PATCH 2/2] phiopt: Reject non gimple val inside
- factor_out_conditional_operation [PR116412]
-
-After the conversion to use maybe_push_res_to_seq, sometimes (REALPART_EXPR
-and IMAGPART_EXPR and VCE) the argument will not be a gimple value and
-then phiopt here would create an invalid PHI.
-Just add a check for gimple val is the way to fix this.
-
-Bootstrapped and tested on x86_64-linux-gnu.
-
-	PR tree-optimization/116412
-
-gcc/ChangeLog:
-
-	* tree-ssa-phiopt.cc (factor_out_conditional_operation): Make sure new_arg0
-	and new_arg1 are both gimple values.
-
-gcc/testsuite/ChangeLog:
-
-	* gcc.dg/torture/pr116412-1.c: New test.
-
-Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
----
- gcc/testsuite/gcc.dg/torture/pr116412-1.c | 6 ++++++
- gcc/tree-ssa-phiopt.cc                    | 4 ++++
- 2 files changed, 10 insertions(+)
- create mode 100644 gcc/testsuite/gcc.dg/torture/pr116412-1.c
-
-diff --git a/gcc/testsuite/gcc.dg/torture/pr116412-1.c b/gcc/testsuite/gcc.dg/torture/pr116412-1.c
-new file mode 100644
-index 000000000000..3bc26ecd8b83
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/torture/pr116412-1.c
-@@ -0,0 +1,6 @@
-+/* { dg-do compile } */
-+double f(_Complex double a, _Complex double *b, int c)
-+{
-+  if (c) return __real__ a;
-+  return __real__ *b;
-+}
-diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
-index 770f3629fe1d..be95798a065b 100644
---- a/gcc/tree-ssa-phiopt.cc
-+++ b/gcc/tree-ssa-phiopt.cc
-@@ -368,6 +368,10 @@ factor_out_conditional_operation (edge e0, edge e1, gphi *phi,
-   if (!types_compatible_p (TREE_TYPE (new_arg0), TREE_TYPE (new_arg1)))
-     return NULL;
- 
-+  /* The new args need to be both gimple values. */
-+  if (!is_gimple_val (new_arg0) || !is_gimple_val (new_arg1))
-+    return NULL;
-+
-   /* Function calls can only be const or an internal function
-      as maybe_push_res_to_seq only handles those currently.  */
-   if (!arg0_op.code.is_tree_code ())
--- 
-2.46.0
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 0c430eb..82e55aa 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,8 @@
+11	????
+
+	- 32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch
+	- 33_all_phiopt-Reject-non-gimple-val-inside-factor_out_condi.patch
+
 10	19 August 2024
 
 	+ 32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-23 13:51 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-23 13:51 UTC (permalink / raw
  To: gentoo-commits

commit:     fec800d970afa89845479d5d6ad58140eaae5035
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  5 07:57:11 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug 23 13:51:19 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=fec800d9

15.0.0: add 09_all_esysroot.patch

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

 15.0.0/gentoo/09_all_esysroot.patch | 67 +++++++++++++++++++++++++++++++++++++
 15.0.0/gentoo/README.history        |  1 +
 2 files changed, 68 insertions(+)

diff --git a/15.0.0/gentoo/09_all_esysroot.patch b/15.0.0/gentoo/09_all_esysroot.patch
new file mode 100644
index 0000000..80e0561
--- /dev/null
+++ b/15.0.0/gentoo/09_all_esysroot.patch
@@ -0,0 +1,67 @@
+From 71e048084d32811f6e17e73b6ebadfe550ef1193 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sun, 4 Aug 2024 17:02:06 +0100
+Subject: [PATCH] Allow setting target sysroot with ESYSROOT env var for
+ cross-compilers
+
+The variable is ignored for native compilers. The --sysroot command line
+option takes precedence.
+
+Signed-off-by: James Le Cuirot <chewi@gentoo.org>
+---
+ gcc/doc/invoke.texi | 10 ++++++++++
+ gcc/gcc.cc          | 10 ++++++++++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index 0fe99ca8e..434cf30e2 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -19230,6 +19230,10 @@ for this option.  If your linker does not support this option, the
+ header file aspect of @option{--sysroot} still works, but the
+ library aspect does not.
+ 
++On Gentoo Linux, this option can also be set for cross-compilers using the
++@env{ESYSROOT} environmnent variable.  The variable is ignored for native
++compilers.  The command line option takes precedence.
++
+ @opindex no-sysroot-suffix
+ @item --no-sysroot-suffix
+ For some targets, a suffix is added to the root directory specified
+@@ -37657,6 +37661,12 @@ using GCC also uses these directories when searching for ordinary
+ libraries for the @option{-l} option (but directories specified with
+ @option{-L} come first).
+ 
++@vindex ESYSROOT
++@item ESYSROOT
++On Gentoo Linux, this variable sets the logical root directory for headers and
++libraries for cross-compilers.  It is ignored for native compilers.  The
++@option{--sysroot} option takes precedence.
++
+ @vindex LANG
+ @cindex locale definition
+ @item LANG
+diff --git a/gcc/gcc.cc b/gcc/gcc.cc
+index abdb40bfe..956363ddb 100644
+--- a/gcc/gcc.cc
++++ b/gcc/gcc.cc
+@@ -5516,6 +5516,16 @@ process_command (unsigned int decoded_options_count,
+ 	      "BINUTILS", PREFIX_PRIORITY_LAST, 0, 1);
+   free (tooldir_prefix);
+ 
++  if (*cross_compile == '1' && !target_system_root_changed)
++    {
++      const char *esysroot = env.get("ESYSROOT");
++      if (esysroot && esysroot[0] != '\0' && strcmp(esysroot, "/") != 0 && (!target_system_root || strcmp(esysroot, target_system_root) != 0))
++	{
++	  target_system_root = esysroot;
++	  target_system_root_changed = 1;
++	}
++    }
++
+ #if defined(TARGET_SYSTEM_ROOT_RELOCATABLE) && !defined(VMS)
+   /* If the normal TARGET_SYSTEM_ROOT is inside of $exec_prefix,
+      then consider it to relocate with the rest of the GCC installation
+-- 
+2.45.2
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 82e55aa..76096c4 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -2,6 +2,7 @@
 
 	- 32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch
 	- 33_all_phiopt-Reject-non-gimple-val-inside-factor_out_condi.patch
+	+ 09_all_esysroot.patch
 
 10	19 August 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-26  6:24 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-26  6:24 UTC (permalink / raw
  To: gentoo-commits

commit:     b6fdeaf382dd20760fc3baf1ca9ff3db9f58c14d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 26 06:23:04 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 26 06:23:13 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b6fdeaf3

15.0.0: cut 11 patchset, add two patches

* Add an ICE fix for vectorization (PR116348)
* Fix bootstrap on x86 w/ debug info (PR116470)

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

 .../gentoo/32_all_PR116470-debug-bootstrap.patch   | 78 ++++++++++++++++++++++
 15.0.0/gentoo/33_all_PR116348-vect.patch           | 78 ++++++++++++++++++++++
 15.0.0/gentoo/README.history                       |  4 +-
 3 files changed, 159 insertions(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/32_all_PR116470-debug-bootstrap.patch b/15.0.0/gentoo/32_all_PR116470-debug-bootstrap.patch
new file mode 100644
index 0000000..613cf4c
--- /dev/null
+++ b/15.0.0/gentoo/32_all_PR116470-debug-bootstrap.patch
@@ -0,0 +1,78 @@
+https://gcc.gnu.org/PR116470
+https://inbox.sourceware.org/gcc-patches/AS1PR01MB946587924CF9EFA4950ECBAFE48B2@AS1PR01MB9465.eurprd01.prod.exchangelabs.com/
+
+From 9c7050effd98d868d59fbd5ec7eeff1160eb05b8 Mon Sep 17 00:00:00 2001
+Message-ID: <9c7050effd98d868d59fbd5ec7eeff1160eb05b8.1724653254.git.sam@gentoo.org>
+From: Bernd Edlinger <bernd.edlinger@hotmail.de>
+Date: Mon, 26 Aug 2024 05:46:16 +0200
+Subject: [PATCH] Fix bootstap-errors due to enabling -gvariable-location-views
+
+This recent change triggered various bootsteap-errors, mostly on
+x86 targets because line info advance address entries were output
+in the wrong section table.
+The switch to the wrong line table happened in dwarfout_set_ignored_loc.
+It must use the same section as the earlier called
+dwarf2out_switch_text_section.
+
+But also ft32-elf was affected, because the assembler choked on
+something simple as ".2byte .LM2-.LM1", but fortunately it is
+able to use native location views, the configure test was just
+not executed because the ft32 "nop" instruction was missing.
+
+gcc/ChangeLog:
+
+PR debug/116470
+	* configure.ac: Add the "nop" instruction for cpu type ft32.
+	* configure: Regenerate.
+	* dwarf2out.cc (dwarf2out_set_ignored_loc): Use the correct
+	line info section.
+---
+ gcc/configure    | 2 +-
+ gcc/configure.ac | 2 +-
+ gcc/dwarf2out.cc | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/gcc/configure b/gcc/configure
+index 557ea5fa3ac9..3d301b6ecd3d 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -31398,7 +31398,7 @@ esac
+ case "$cpu_type" in
+   aarch64 | alpha | arc | arm | avr | bfin | cris | csky | i386 | loongarch | m32c \
+   | m68k | microblaze | mips | nds32 | nios2 | pa | riscv | rs6000 | score | sparc \
+-  | visium | xstormy16 | xtensa)
++  | visium | xstormy16 | xtensa | ft32)
+     insn="nop"
+     ;;
+   ia64 | s390)
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index eaa01d0d7e56..8a2d2b0438e7 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -5610,7 +5610,7 @@ esac
+ case "$cpu_type" in
+   aarch64 | alpha | arc | arm | avr | bfin | cris | csky | i386 | loongarch | m32c \
+   | m68k | microblaze | mips | nds32 | nios2 | pa | riscv | rs6000 | score | sparc \
+-  | visium | xstormy16 | xtensa)
++  | visium | xstormy16 | xtensa | ft32)
+     insn="nop"
+     ;;
+   ia64 | s390)
+diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
+index 633900b035fe..3f040da33a63 100644
+--- a/gcc/dwarf2out.cc
++++ b/gcc/dwarf2out.cc
+@@ -28939,7 +28939,7 @@ dwarf2out_set_ignored_loc (unsigned int line, unsigned int column,
+   dw_fde_ref fde = cfun->fde;
+ 
+   fde->ignored_debug = false;
+-  set_cur_line_info_table (function_section (fde->decl));
++  set_cur_line_info_table (current_function_section ());
+ 
+   dwarf2out_source_line (line, column, filename, 0, true);
+ }
+
+base-commit: b4ac2c23d8745d98984954e88f02aa73f1c3594b
+-- 
+2.46.0
+

diff --git a/15.0.0/gentoo/33_all_PR116348-vect.patch b/15.0.0/gentoo/33_all_PR116348-vect.patch
new file mode 100644
index 0000000..623ce34
--- /dev/null
+++ b/15.0.0/gentoo/33_all_PR116348-vect.patch
@@ -0,0 +1,78 @@
+https://gcc.gnu.org/PR116348
+https://inbox.sourceware.org/gcc-patches/20240825185348.37025-1-xry111@xry111.site/T/#u
+
+From cc68092ef1bb1134f6d8ddf0281323658a4358ae Mon Sep 17 00:00:00 2001
+Message-ID: <cc68092ef1bb1134f6d8ddf0281323658a4358ae.1724653336.git.sam@gentoo.org>
+From: Xi Ruoyao <xry111@xry111.site>
+Date: Mon, 26 Aug 2024 02:53:13 +0800
+Subject: [PATCH] vect: Fix STMT_VINFO_DEF_TYPE check for odd/even widen mult
+ [PR116348]
+
+After fixing PR116142 some code started to trigger an ICE with -O3
+-march=znver4.  Per Richard Biener who actually made this fix:
+
+"supportable_widening_operation fails at transform time - that's likely
+because vectorizable_reduction "puns" defs to internal_def"
+
+so the check should use STMT_VINFO_REDUC_DEF instead of checking if
+STMT_VINFO_DEF_TYPE is vect_reduction_def.
+
+gcc/ChangeLog:
+
+	PR tree-optimization/PR116348
+	* tree-vect-stmts.cc (supportable_widening_operation): Use
+	STMT_VINFO_REDUC_DEF (x) instead of
+	STMT_VINFO_DEF_TYPE (x) == vect_reduction_def.
+
+gcc/testsuite/ChangeLog:
+
+	PR tree-optimization/PR116348
+	* gcc.c-torture/compile/pr116438.c: New test.
+
+Co-authored-by: Richard Biener <rguenther@suse.de>
+---
+ gcc/testsuite/gcc.c-torture/compile/pr116438.c | 14 ++++++++++++++
+ gcc/tree-vect-stmts.cc                         |  3 +--
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr116438.c
+
+diff --git a/gcc/testsuite/gcc.c-torture/compile/pr116438.c b/gcc/testsuite/gcc.c-torture/compile/pr116438.c
+new file mode 100644
+index 000000000000..97ab0181ab8b
+--- /dev/null
++++ b/gcc/testsuite/gcc.c-torture/compile/pr116438.c
+@@ -0,0 +1,14 @@
++/* { dg-additional-options "-march=znver4" { target x86_64-*-* i?86-*-* } } */
++
++int *a;
++int b;
++long long c, d;
++void
++e (int f)
++{
++  for (; f; f++)
++    {
++      d += (long long)a[f] * b;
++      c += (long long)a[f] * 3;
++    }
++}
+diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
+index 385e63163c24..9eb73a599339 100644
+--- a/gcc/tree-vect-stmts.cc
++++ b/gcc/tree-vect-stmts.cc
+@@ -14193,8 +14193,7 @@ supportable_widening_operation (vec_info *vinfo,
+              by STMT is only directly used in the reduction statement.  */
+ 	  tree lhs = gimple_assign_lhs (vect_orig_stmt (stmt_info)->stmt);
+ 	  stmt_vec_info use_stmt_info = loop_info->lookup_single_use (lhs);
+-	  if (use_stmt_info
+-	      && STMT_VINFO_DEF_TYPE (use_stmt_info) == vect_reduction_def)
++	  if (use_stmt_info && STMT_VINFO_REDUC_DEF (use_stmt_info))
+ 	    return true;
+         }
+       c1 = VEC_WIDEN_MULT_LO_EXPR;
+
+base-commit: b4ac2c23d8745d98984954e88f02aa73f1c3594b
+prerequisite-patch-id: 743f4e4444f9cac24e67abce2bda52d6a421d870
+-- 
+2.46.0
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 76096c4..728080e 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,8 +1,10 @@
-11	????
+11	26 August 2024
 
 	- 32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch
 	- 33_all_phiopt-Reject-non-gimple-val-inside-factor_out_condi.patch
 	+ 09_all_esysroot.patch
+	+ 32_all_PR116470-debug-bootstrap.patch
+	+ 33_all_PR116348-vect.patch
 
 10	19 August 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-08-26 13:44 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-08-26 13:44 UTC (permalink / raw
  To: gentoo-commits

commit:     24f7b8a07ce29ac39d8d3245a1ba7f7abf3dcfa1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 26 13:43:58 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 26 13:43:58 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=24f7b8a0

15.0.0: drop now-upstream patches

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

 .../gentoo/32_all_PR116470-debug-bootstrap.patch   | 78 ----------------------
 15.0.0/gentoo/33_all_PR116348-vect.patch           | 78 ----------------------
 15.0.0/gentoo/README.history                       |  5 ++
 3 files changed, 5 insertions(+), 156 deletions(-)

diff --git a/15.0.0/gentoo/32_all_PR116470-debug-bootstrap.patch b/15.0.0/gentoo/32_all_PR116470-debug-bootstrap.patch
deleted file mode 100644
index 613cf4c..0000000
--- a/15.0.0/gentoo/32_all_PR116470-debug-bootstrap.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-https://gcc.gnu.org/PR116470
-https://inbox.sourceware.org/gcc-patches/AS1PR01MB946587924CF9EFA4950ECBAFE48B2@AS1PR01MB9465.eurprd01.prod.exchangelabs.com/
-
-From 9c7050effd98d868d59fbd5ec7eeff1160eb05b8 Mon Sep 17 00:00:00 2001
-Message-ID: <9c7050effd98d868d59fbd5ec7eeff1160eb05b8.1724653254.git.sam@gentoo.org>
-From: Bernd Edlinger <bernd.edlinger@hotmail.de>
-Date: Mon, 26 Aug 2024 05:46:16 +0200
-Subject: [PATCH] Fix bootstap-errors due to enabling -gvariable-location-views
-
-This recent change triggered various bootsteap-errors, mostly on
-x86 targets because line info advance address entries were output
-in the wrong section table.
-The switch to the wrong line table happened in dwarfout_set_ignored_loc.
-It must use the same section as the earlier called
-dwarf2out_switch_text_section.
-
-But also ft32-elf was affected, because the assembler choked on
-something simple as ".2byte .LM2-.LM1", but fortunately it is
-able to use native location views, the configure test was just
-not executed because the ft32 "nop" instruction was missing.
-
-gcc/ChangeLog:
-
-PR debug/116470
-	* configure.ac: Add the "nop" instruction for cpu type ft32.
-	* configure: Regenerate.
-	* dwarf2out.cc (dwarf2out_set_ignored_loc): Use the correct
-	line info section.
----
- gcc/configure    | 2 +-
- gcc/configure.ac | 2 +-
- gcc/dwarf2out.cc | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/gcc/configure b/gcc/configure
-index 557ea5fa3ac9..3d301b6ecd3d 100755
---- a/gcc/configure
-+++ b/gcc/configure
-@@ -31398,7 +31398,7 @@ esac
- case "$cpu_type" in
-   aarch64 | alpha | arc | arm | avr | bfin | cris | csky | i386 | loongarch | m32c \
-   | m68k | microblaze | mips | nds32 | nios2 | pa | riscv | rs6000 | score | sparc \
--  | visium | xstormy16 | xtensa)
-+  | visium | xstormy16 | xtensa | ft32)
-     insn="nop"
-     ;;
-   ia64 | s390)
-diff --git a/gcc/configure.ac b/gcc/configure.ac
-index eaa01d0d7e56..8a2d2b0438e7 100644
---- a/gcc/configure.ac
-+++ b/gcc/configure.ac
-@@ -5610,7 +5610,7 @@ esac
- case "$cpu_type" in
-   aarch64 | alpha | arc | arm | avr | bfin | cris | csky | i386 | loongarch | m32c \
-   | m68k | microblaze | mips | nds32 | nios2 | pa | riscv | rs6000 | score | sparc \
--  | visium | xstormy16 | xtensa)
-+  | visium | xstormy16 | xtensa | ft32)
-     insn="nop"
-     ;;
-   ia64 | s390)
-diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
-index 633900b035fe..3f040da33a63 100644
---- a/gcc/dwarf2out.cc
-+++ b/gcc/dwarf2out.cc
-@@ -28939,7 +28939,7 @@ dwarf2out_set_ignored_loc (unsigned int line, unsigned int column,
-   dw_fde_ref fde = cfun->fde;
- 
-   fde->ignored_debug = false;
--  set_cur_line_info_table (function_section (fde->decl));
-+  set_cur_line_info_table (current_function_section ());
- 
-   dwarf2out_source_line (line, column, filename, 0, true);
- }
-
-base-commit: b4ac2c23d8745d98984954e88f02aa73f1c3594b
--- 
-2.46.0
-

diff --git a/15.0.0/gentoo/33_all_PR116348-vect.patch b/15.0.0/gentoo/33_all_PR116348-vect.patch
deleted file mode 100644
index 623ce34..0000000
--- a/15.0.0/gentoo/33_all_PR116348-vect.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-https://gcc.gnu.org/PR116348
-https://inbox.sourceware.org/gcc-patches/20240825185348.37025-1-xry111@xry111.site/T/#u
-
-From cc68092ef1bb1134f6d8ddf0281323658a4358ae Mon Sep 17 00:00:00 2001
-Message-ID: <cc68092ef1bb1134f6d8ddf0281323658a4358ae.1724653336.git.sam@gentoo.org>
-From: Xi Ruoyao <xry111@xry111.site>
-Date: Mon, 26 Aug 2024 02:53:13 +0800
-Subject: [PATCH] vect: Fix STMT_VINFO_DEF_TYPE check for odd/even widen mult
- [PR116348]
-
-After fixing PR116142 some code started to trigger an ICE with -O3
--march=znver4.  Per Richard Biener who actually made this fix:
-
-"supportable_widening_operation fails at transform time - that's likely
-because vectorizable_reduction "puns" defs to internal_def"
-
-so the check should use STMT_VINFO_REDUC_DEF instead of checking if
-STMT_VINFO_DEF_TYPE is vect_reduction_def.
-
-gcc/ChangeLog:
-
-	PR tree-optimization/PR116348
-	* tree-vect-stmts.cc (supportable_widening_operation): Use
-	STMT_VINFO_REDUC_DEF (x) instead of
-	STMT_VINFO_DEF_TYPE (x) == vect_reduction_def.
-
-gcc/testsuite/ChangeLog:
-
-	PR tree-optimization/PR116348
-	* gcc.c-torture/compile/pr116438.c: New test.
-
-Co-authored-by: Richard Biener <rguenther@suse.de>
----
- gcc/testsuite/gcc.c-torture/compile/pr116438.c | 14 ++++++++++++++
- gcc/tree-vect-stmts.cc                         |  3 +--
- 2 files changed, 15 insertions(+), 2 deletions(-)
- create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr116438.c
-
-diff --git a/gcc/testsuite/gcc.c-torture/compile/pr116438.c b/gcc/testsuite/gcc.c-torture/compile/pr116438.c
-new file mode 100644
-index 000000000000..97ab0181ab8b
---- /dev/null
-+++ b/gcc/testsuite/gcc.c-torture/compile/pr116438.c
-@@ -0,0 +1,14 @@
-+/* { dg-additional-options "-march=znver4" { target x86_64-*-* i?86-*-* } } */
-+
-+int *a;
-+int b;
-+long long c, d;
-+void
-+e (int f)
-+{
-+  for (; f; f++)
-+    {
-+      d += (long long)a[f] * b;
-+      c += (long long)a[f] * 3;
-+    }
-+}
-diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
-index 385e63163c24..9eb73a599339 100644
---- a/gcc/tree-vect-stmts.cc
-+++ b/gcc/tree-vect-stmts.cc
-@@ -14193,8 +14193,7 @@ supportable_widening_operation (vec_info *vinfo,
-              by STMT is only directly used in the reduction statement.  */
- 	  tree lhs = gimple_assign_lhs (vect_orig_stmt (stmt_info)->stmt);
- 	  stmt_vec_info use_stmt_info = loop_info->lookup_single_use (lhs);
--	  if (use_stmt_info
--	      && STMT_VINFO_DEF_TYPE (use_stmt_info) == vect_reduction_def)
-+	  if (use_stmt_info && STMT_VINFO_REDUC_DEF (use_stmt_info))
- 	    return true;
-         }
-       c1 = VEC_WIDEN_MULT_LO_EXPR;
-
-base-commit: b4ac2c23d8745d98984954e88f02aa73f1c3594b
-prerequisite-patch-id: 743f4e4444f9cac24e67abce2bda52d6a421d870
--- 
-2.46.0
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 728080e..e1c375e 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,8 @@
+12	????
+
+	- 32_all_PR116470-debug-bootstrap.patch
+	- 33_all_PR116348-vect.patch
+
 11	26 August 2024
 
 	- 32_all_phi-opt-Fix-for-non-const-functions-for-factor_out_c.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-09-02  2:28 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-09-02  2:28 UTC (permalink / raw
  To: gentoo-commits

commit:     d676863b64b58bf73a7f26eea70f81aeba517b13
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Sep  2 02:28:39 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep  2 02:28:39 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d676863b

15.0.0: cut patchset 12

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index e1c375e..a035c01 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-12	????
+12	1 September 2024
 
 	- 32_all_PR116470-debug-bootstrap.patch
 	- 33_all_PR116348-vect.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-09-23 15:23 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-09-23 15:23 UTC (permalink / raw
  To: gentoo-commits

commit:     690e151179e3dc40e99b3beeb551ac50b321d456
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 23 15:23:35 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep 23 15:23:35 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=690e1511

15.0.0: add 70_all_middle-end-check-explicitly-for-external-or-constant.patch

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

 ...check-explicitly-for-external-or-constant.patch | 93 ++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git a/15.0.0/gentoo/70_all_middle-end-check-explicitly-for-external-or-constant.patch b/15.0.0/gentoo/70_all_middle-end-check-explicitly-for-external-or-constant.patch
new file mode 100644
index 0000000..6dcc1a4
--- /dev/null
+++ b/15.0.0/gentoo/70_all_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
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-09-24  1:41 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-09-24  1:41 UTC (permalink / raw
  To: gentoo-commits

commit:     3e1c7a2699f90793d9bf7107cb0b5943ba7c76c1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 24 01:41:22 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 24 01:41:22 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=3e1c7a26

15.0.0: update 70_all_middle-end-check-explicitly-for-external-or-constant.patch

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

 ...middle-end-check-explicitly-for-external-or-constant.patch | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/15.0.0/gentoo/70_all_middle-end-check-explicitly-for-external-or-constant.patch b/15.0.0/gentoo/70_all_middle-end-check-explicitly-for-external-or-constant.patch
index 6dcc1a4..7dcf89d 100644
--- a/15.0.0/gentoo/70_all_middle-end-check-explicitly-for-external-or-constant.patch
+++ b/15.0.0/gentoo/70_all_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
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-09-29 22:56 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-09-29 22:56 UTC (permalink / raw
  To: gentoo-commits

commit:     891af478cc93ae3e2e176ed9739166799b814a05
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 29 22:55:02 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep 29 22:55:28 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=891af478

15.0.0: add 71_all_PR116878-libcall.patch

It's been approved but not yet merged.

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

 15.0.0/gentoo/71_all_PR116878-libcall.patch | 215 ++++++++++++++++++++++++++++
 15.0.0/gentoo/README.history                |   4 +
 2 files changed, 219 insertions(+)

diff --git a/15.0.0/gentoo/71_all_PR116878-libcall.patch b/15.0.0/gentoo/71_all_PR116878-libcall.patch
new file mode 100644
index 0000000..781196d
--- /dev/null
+++ b/15.0.0/gentoo/71_all_PR116878-libcall.patch
@@ -0,0 +1,215 @@
+https://gcc.gnu.org/PR116878
+https://gcc.gnu.org/PR116616
+
+From b9883d33e6338b1a44247b3f8772a5e5d2757593 Mon Sep 17 00:00:00 2001
+Message-ID: <b9883d33e6338b1a44247b3f8772a5e5d2757593.1727650422.git.sam@gentoo.org>
+From: Filip Kastl <fkastl@suse.cz>
+Date: Tue, 10 Sep 2024 19:22:27 +0200
+Subject: [PATCH] gimple ssa: Don't use __builtin_popcount in switch exp
+ transform
+
+Switch exponential transformation in the switch conversion pass
+currently generates
+
+tmp1 = __builtin_popcount (var);
+tmp2 = tmp1 == 1;
+
+when inserting code to determine if var is power of two.  If the target
+doesn't support expanding the builtin as special instructions switch
+conversion relies on this whole pattern being expanded as bitmagic.
+However, it is possible that other GIMPLE optimizations move the two
+statements of the pattern apart.  In that case the builtin becomes a
+libgcc call in the final binary.  The call is slow and in case of
+freestanding programs can result in linking error (this bug was
+originally found while compiling Linux kernel).
+
+This patch modifies switch conversion to insert the bitmagic
+(var ^ (var - 1)) > (var - 1) instead of the builtin.
+
+gcc/ChangeLog:
+
+	PR tree-optimization/116616
+	* tree-switch-conversion.cc (can_pow2p): Remove this function.
+	(gen_pow2p): Generate bitmagic instead of a builtin.  Remove the
+	TYPE parameter.
+	(switch_conversion::is_exp_index_transform_viable): Don't call
+	can_pow2p.
+	(switch_conversion::exp_index_transform): Call gen_pow2p without
+	the TYPE parameter.
+	* tree-switch-conversion.h: Remove
+	m_exp_index_transform_pow2p_type.
+
+gcc/testsuite/ChangeLog:
+
+	PR tree-optimization/116616
+	* gcc.target/i386/switch-exp-transform-1.c: Don't test for
+	presence of the POPCOUNT internal fn call.
+
+Signed-off-by: Filip Kastl <fkastl@suse.cz>
+---
+ .../gcc.target/i386/switch-exp-transform-1.c  |  7 +-
+ gcc/tree-switch-conversion.cc                 | 84 +++++--------------
+ gcc/tree-switch-conversion.h                  |  6 +-
+ 3 files changed, 23 insertions(+), 74 deletions(-)
+
+diff --git a/gcc/testsuite/gcc.target/i386/switch-exp-transform-1.c b/gcc/testsuite/gcc.target/i386/switch-exp-transform-1.c
+index a8c9e03e515f..4832f5b52c33 100644
+--- a/gcc/testsuite/gcc.target/i386/switch-exp-transform-1.c
++++ b/gcc/testsuite/gcc.target/i386/switch-exp-transform-1.c
+@@ -1,10 +1,8 @@
+ /* { dg-do compile } */
+-/* { dg-options "-O2 -fdump-tree-switchconv -fdump-tree-widening_mul -mpopcnt -mbmi" } */
++/* { dg-options "-O2 -fdump-tree-switchconv -mbmi" } */
+ 
+ /* Checks that exponential index transform enables switch conversion to convert
+-   this switch into an array lookup.  Also checks that the "index variable is a
+-   power of two" check has been generated and that it has been later expanded
+-   into an internal function.  */
++   this switch into an array lookup.  */
+ 
+ int foo(unsigned bar)
+ {
+@@ -30,4 +28,3 @@ int foo(unsigned bar)
+ }
+ 
+ /* { dg-final { scan-tree-dump "CSWTCH" "switchconv" } } */
+-/* { dg-final { scan-tree-dump "POPCOUNT" "widening_mul" } } */
+diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
+index c1332a260943..00426d400006 100644
+--- a/gcc/tree-switch-conversion.cc
++++ b/gcc/tree-switch-conversion.cc
+@@ -133,75 +133,33 @@ gen_log2 (tree op, location_t loc, tree *result, tree type)
+   return stmts;
+ }
+ 
+-/* Is it possible to efficiently check that a value of TYPE is a power of 2?
+-
+-   If yes, returns TYPE.  If no, returns NULL_TREE.  May also return another
+-   type.  This indicates that logarithm of the variable can be computed but
+-   only after it is converted to this type.
+-
+-   Also see gen_pow2p.  */
+-
+-static tree
+-can_pow2p (tree type)
+-{
+-  /* __builtin_popcount supports the unsigned type or its long and long long
+-     variants.  Choose the smallest out of those that can still fit TYPE.  */
+-  int prec = TYPE_PRECISION (type);
+-  int i_prec = TYPE_PRECISION (unsigned_type_node);
+-  int li_prec = TYPE_PRECISION (long_unsigned_type_node);
+-  int lli_prec = TYPE_PRECISION (long_long_unsigned_type_node);
+-
+-  if (prec <= i_prec)
+-    return unsigned_type_node;
+-  else if (prec <= li_prec)
+-    return long_unsigned_type_node;
+-  else if (prec <= lli_prec)
+-    return long_long_unsigned_type_node;
+-  else
+-    return NULL_TREE;
+-}
+-
+-/* Build a sequence of gimple statements checking that OP is a power of 2.  Use
+-   special optabs if target supports them.  Return the result as a
+-   boolean_type_node ssa name through RESULT.  Assumes that OP's value will
+-   be non-negative.  The generated check may give arbitrary answer for negative
+-   values.
+-
+-   Before computing the check, OP may have to be converted to another type.
+-   This should be specified in TYPE.  Use can_pow2p to decide what this type
+-   should be.
+-
+-   Should only be used if can_pow2p returns true for type of OP.  */
++/* Build a sequence of gimple statements checking that OP is a power of 2.
++   Return the result as a boolean_type_node ssa name through RESULT.  Assumes
++   that OP's value will be non-negative.  The generated check may give
++   arbitrary answer for negative values.  */
+ 
+ static gimple_seq
+-gen_pow2p (tree op, location_t loc, tree *result, tree type)
++gen_pow2p (tree op, location_t loc, tree *result)
+ {
+   gimple_seq stmts = NULL;
+   gimple_stmt_iterator gsi = gsi_last (stmts);
+ 
+-  built_in_function fn;
+-  if (type == unsigned_type_node)
+-    fn = BUILT_IN_POPCOUNT;
+-  else if (type == long_unsigned_type_node)
+-    fn = BUILT_IN_POPCOUNTL;
+-  else
+-    {
+-      fn = BUILT_IN_POPCOUNTLL;
+-      gcc_checking_assert (type == long_long_unsigned_type_node);
+-    }
++  tree type = TREE_TYPE (op);
++  tree utype = unsigned_type_for (type);
+ 
+-  tree orig_type = TREE_TYPE (op);
++  /* Build (op ^ (op - 1)) > (op - 1).  */
+   tree tmp1;
+-  if (type != orig_type)
+-    tmp1 = gimple_convert (&gsi, false, GSI_NEW_STMT, loc, type, op);
+-  else
++  if (types_compatible_p (type, utype))
+     tmp1 = op;
+-  /* Build __builtin_popcount{l,ll} (op) == 1.  */
+-  tree tmp2 = gimple_build (&gsi, false, GSI_NEW_STMT, loc,
+-			    as_combined_fn (fn), integer_type_node, tmp1);
+-  *result = gimple_build (&gsi, false, GSI_NEW_STMT, loc, EQ_EXPR,
+-			  boolean_type_node, tmp2,
+-			  build_one_cst (integer_type_node));
++  else
++    tmp1 = gimple_convert (&gsi, false, GSI_NEW_STMT, loc, utype, op);
++  tree tmp2 = gimple_build (&gsi, false, GSI_NEW_STMT, loc, MINUS_EXPR, utype,
++			    tmp1, build_one_cst (utype));
++  tree tmp3 = gimple_build (&gsi, false, GSI_NEW_STMT, loc, BIT_XOR_EXPR,
++			    utype, tmp1, tmp2);
++  *result = gimple_build (&gsi, false, GSI_NEW_STMT, loc, GT_EXPR,
++			  boolean_type_node, tmp3, tmp2);
++
+   return stmts;
+ }
+ 
+@@ -371,9 +329,6 @@ switch_conversion::is_exp_index_transform_viable (gswitch *swtch)
+   m_exp_index_transform_log2_type = can_log2 (index_type, opt_type);
+   if (!m_exp_index_transform_log2_type)
+     return false;
+-  m_exp_index_transform_pow2p_type = can_pow2p (index_type);
+-  if (!m_exp_index_transform_pow2p_type)
+-    return false;
+ 
+   /* Check that each case label corresponds only to one value
+      (no case 1..3).  */
+@@ -467,8 +422,7 @@ switch_conversion::exp_index_transform (gswitch *swtch)
+   new_edge2->probability = profile_probability::even ();
+ 
+   tree tmp;
+-  gimple_seq stmts = gen_pow2p (index, UNKNOWN_LOCATION, &tmp,
+-				m_exp_index_transform_pow2p_type);
++  gimple_seq stmts = gen_pow2p (index, UNKNOWN_LOCATION, &tmp);
+   gsi = gsi_last_bb (cond_bb);
+   gsi_insert_seq_after (&gsi, stmts, GSI_LAST_NEW_STMT);
+   gcond *stmt_cond = gimple_build_cond (NE_EXPR, tmp, boolean_false_node,
+diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h
+index 14610499e5fb..6468995eb316 100644
+--- a/gcc/tree-switch-conversion.h
++++ b/gcc/tree-switch-conversion.h
+@@ -920,11 +920,9 @@ public:
+   bool m_exp_index_transform_applied;
+ 
+   /* If switch conversion decided exponential index transform is viable, here
+-     will be stored the types to which index variable has to be converted
+-     before the logarithm and the "is power of 2" operations which are part of
+-     the transform.  */
++     will be stored the type to which index variable has to be converted
++     before the logarithm operation which is a part of the transform.  */
+   tree m_exp_index_transform_log2_type;
+-  tree m_exp_index_transform_pow2p_type;
+ };
+ 
+ void
+-- 
+2.46.2
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index a035c01..6c31450 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+13	29 September 2024
+
+	+ 71_all_PR116878-libcall.patch
+
 12	1 September 2024
 
 	- 32_all_PR116470-debug-bootstrap.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-09-30 14:05 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-09-30 14:05 UTC (permalink / raw
  To: gentoo-commits

commit:     4dffefc137f5ba6524cdb6eb598313646c5df6c8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 30 14:05:13 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep 30 14:05:13 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=4dffefc1

15.0.0: drop 70_all_middle-end-check-explicitly-for-external-or-constant.patch

Merged upstream.

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

 ...check-explicitly-for-external-or-constant.patch | 88 ----------------------
 15.0.0/gentoo/README.history                       |  5 ++
 2 files changed, 5 insertions(+), 88 deletions(-)

diff --git a/15.0.0/gentoo/70_all_middle-end-check-explicitly-for-external-or-constant.patch b/15.0.0/gentoo/70_all_middle-end-check-explicitly-for-external-or-constant.patch
deleted file mode 100644
index 7dcf89d..0000000
--- a/15.0.0/gentoo/70_all_middle-end-check-explicitly-for-external-or-constant.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-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 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,
-       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.  */

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 6c31450..819d192 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,5 +1,10 @@
+14	????
+
+	- 70_all_middle-end-check-explicitly-for-external-or-constant.patch
+
 13	29 September 2024
 
+	+ 70_all_middle-end-check-explicitly-for-external-or-constant.patch
 	+ 71_all_PR116878-libcall.patch
 
 12	1 September 2024


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-02 19:45 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-02 19:45 UTC (permalink / raw
  To: gentoo-commits

commit:     6566f31fc01e405d7cad5739140fb61e98b0dd82
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  2 19:44:53 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct  2 19:44:53 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=6566f31f

15.0.0: drop 71_all_PR116878-libcall.patch

Merged upstream.

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

 15.0.0/gentoo/71_all_PR116878-libcall.patch | 215 ----------------------------
 15.0.0/gentoo/README.history                |   1 +
 2 files changed, 1 insertion(+), 215 deletions(-)

diff --git a/15.0.0/gentoo/71_all_PR116878-libcall.patch b/15.0.0/gentoo/71_all_PR116878-libcall.patch
deleted file mode 100644
index 781196d..0000000
--- a/15.0.0/gentoo/71_all_PR116878-libcall.patch
+++ /dev/null
@@ -1,215 +0,0 @@
-https://gcc.gnu.org/PR116878
-https://gcc.gnu.org/PR116616
-
-From b9883d33e6338b1a44247b3f8772a5e5d2757593 Mon Sep 17 00:00:00 2001
-Message-ID: <b9883d33e6338b1a44247b3f8772a5e5d2757593.1727650422.git.sam@gentoo.org>
-From: Filip Kastl <fkastl@suse.cz>
-Date: Tue, 10 Sep 2024 19:22:27 +0200
-Subject: [PATCH] gimple ssa: Don't use __builtin_popcount in switch exp
- transform
-
-Switch exponential transformation in the switch conversion pass
-currently generates
-
-tmp1 = __builtin_popcount (var);
-tmp2 = tmp1 == 1;
-
-when inserting code to determine if var is power of two.  If the target
-doesn't support expanding the builtin as special instructions switch
-conversion relies on this whole pattern being expanded as bitmagic.
-However, it is possible that other GIMPLE optimizations move the two
-statements of the pattern apart.  In that case the builtin becomes a
-libgcc call in the final binary.  The call is slow and in case of
-freestanding programs can result in linking error (this bug was
-originally found while compiling Linux kernel).
-
-This patch modifies switch conversion to insert the bitmagic
-(var ^ (var - 1)) > (var - 1) instead of the builtin.
-
-gcc/ChangeLog:
-
-	PR tree-optimization/116616
-	* tree-switch-conversion.cc (can_pow2p): Remove this function.
-	(gen_pow2p): Generate bitmagic instead of a builtin.  Remove the
-	TYPE parameter.
-	(switch_conversion::is_exp_index_transform_viable): Don't call
-	can_pow2p.
-	(switch_conversion::exp_index_transform): Call gen_pow2p without
-	the TYPE parameter.
-	* tree-switch-conversion.h: Remove
-	m_exp_index_transform_pow2p_type.
-
-gcc/testsuite/ChangeLog:
-
-	PR tree-optimization/116616
-	* gcc.target/i386/switch-exp-transform-1.c: Don't test for
-	presence of the POPCOUNT internal fn call.
-
-Signed-off-by: Filip Kastl <fkastl@suse.cz>
----
- .../gcc.target/i386/switch-exp-transform-1.c  |  7 +-
- gcc/tree-switch-conversion.cc                 | 84 +++++--------------
- gcc/tree-switch-conversion.h                  |  6 +-
- 3 files changed, 23 insertions(+), 74 deletions(-)
-
-diff --git a/gcc/testsuite/gcc.target/i386/switch-exp-transform-1.c b/gcc/testsuite/gcc.target/i386/switch-exp-transform-1.c
-index a8c9e03e515f..4832f5b52c33 100644
---- a/gcc/testsuite/gcc.target/i386/switch-exp-transform-1.c
-+++ b/gcc/testsuite/gcc.target/i386/switch-exp-transform-1.c
-@@ -1,10 +1,8 @@
- /* { dg-do compile } */
--/* { dg-options "-O2 -fdump-tree-switchconv -fdump-tree-widening_mul -mpopcnt -mbmi" } */
-+/* { dg-options "-O2 -fdump-tree-switchconv -mbmi" } */
- 
- /* Checks that exponential index transform enables switch conversion to convert
--   this switch into an array lookup.  Also checks that the "index variable is a
--   power of two" check has been generated and that it has been later expanded
--   into an internal function.  */
-+   this switch into an array lookup.  */
- 
- int foo(unsigned bar)
- {
-@@ -30,4 +28,3 @@ int foo(unsigned bar)
- }
- 
- /* { dg-final { scan-tree-dump "CSWTCH" "switchconv" } } */
--/* { dg-final { scan-tree-dump "POPCOUNT" "widening_mul" } } */
-diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
-index c1332a260943..00426d400006 100644
---- a/gcc/tree-switch-conversion.cc
-+++ b/gcc/tree-switch-conversion.cc
-@@ -133,75 +133,33 @@ gen_log2 (tree op, location_t loc, tree *result, tree type)
-   return stmts;
- }
- 
--/* Is it possible to efficiently check that a value of TYPE is a power of 2?
--
--   If yes, returns TYPE.  If no, returns NULL_TREE.  May also return another
--   type.  This indicates that logarithm of the variable can be computed but
--   only after it is converted to this type.
--
--   Also see gen_pow2p.  */
--
--static tree
--can_pow2p (tree type)
--{
--  /* __builtin_popcount supports the unsigned type or its long and long long
--     variants.  Choose the smallest out of those that can still fit TYPE.  */
--  int prec = TYPE_PRECISION (type);
--  int i_prec = TYPE_PRECISION (unsigned_type_node);
--  int li_prec = TYPE_PRECISION (long_unsigned_type_node);
--  int lli_prec = TYPE_PRECISION (long_long_unsigned_type_node);
--
--  if (prec <= i_prec)
--    return unsigned_type_node;
--  else if (prec <= li_prec)
--    return long_unsigned_type_node;
--  else if (prec <= lli_prec)
--    return long_long_unsigned_type_node;
--  else
--    return NULL_TREE;
--}
--
--/* Build a sequence of gimple statements checking that OP is a power of 2.  Use
--   special optabs if target supports them.  Return the result as a
--   boolean_type_node ssa name through RESULT.  Assumes that OP's value will
--   be non-negative.  The generated check may give arbitrary answer for negative
--   values.
--
--   Before computing the check, OP may have to be converted to another type.
--   This should be specified in TYPE.  Use can_pow2p to decide what this type
--   should be.
--
--   Should only be used if can_pow2p returns true for type of OP.  */
-+/* Build a sequence of gimple statements checking that OP is a power of 2.
-+   Return the result as a boolean_type_node ssa name through RESULT.  Assumes
-+   that OP's value will be non-negative.  The generated check may give
-+   arbitrary answer for negative values.  */
- 
- static gimple_seq
--gen_pow2p (tree op, location_t loc, tree *result, tree type)
-+gen_pow2p (tree op, location_t loc, tree *result)
- {
-   gimple_seq stmts = NULL;
-   gimple_stmt_iterator gsi = gsi_last (stmts);
- 
--  built_in_function fn;
--  if (type == unsigned_type_node)
--    fn = BUILT_IN_POPCOUNT;
--  else if (type == long_unsigned_type_node)
--    fn = BUILT_IN_POPCOUNTL;
--  else
--    {
--      fn = BUILT_IN_POPCOUNTLL;
--      gcc_checking_assert (type == long_long_unsigned_type_node);
--    }
-+  tree type = TREE_TYPE (op);
-+  tree utype = unsigned_type_for (type);
- 
--  tree orig_type = TREE_TYPE (op);
-+  /* Build (op ^ (op - 1)) > (op - 1).  */
-   tree tmp1;
--  if (type != orig_type)
--    tmp1 = gimple_convert (&gsi, false, GSI_NEW_STMT, loc, type, op);
--  else
-+  if (types_compatible_p (type, utype))
-     tmp1 = op;
--  /* Build __builtin_popcount{l,ll} (op) == 1.  */
--  tree tmp2 = gimple_build (&gsi, false, GSI_NEW_STMT, loc,
--			    as_combined_fn (fn), integer_type_node, tmp1);
--  *result = gimple_build (&gsi, false, GSI_NEW_STMT, loc, EQ_EXPR,
--			  boolean_type_node, tmp2,
--			  build_one_cst (integer_type_node));
-+  else
-+    tmp1 = gimple_convert (&gsi, false, GSI_NEW_STMT, loc, utype, op);
-+  tree tmp2 = gimple_build (&gsi, false, GSI_NEW_STMT, loc, MINUS_EXPR, utype,
-+			    tmp1, build_one_cst (utype));
-+  tree tmp3 = gimple_build (&gsi, false, GSI_NEW_STMT, loc, BIT_XOR_EXPR,
-+			    utype, tmp1, tmp2);
-+  *result = gimple_build (&gsi, false, GSI_NEW_STMT, loc, GT_EXPR,
-+			  boolean_type_node, tmp3, tmp2);
-+
-   return stmts;
- }
- 
-@@ -371,9 +329,6 @@ switch_conversion::is_exp_index_transform_viable (gswitch *swtch)
-   m_exp_index_transform_log2_type = can_log2 (index_type, opt_type);
-   if (!m_exp_index_transform_log2_type)
-     return false;
--  m_exp_index_transform_pow2p_type = can_pow2p (index_type);
--  if (!m_exp_index_transform_pow2p_type)
--    return false;
- 
-   /* Check that each case label corresponds only to one value
-      (no case 1..3).  */
-@@ -467,8 +422,7 @@ switch_conversion::exp_index_transform (gswitch *swtch)
-   new_edge2->probability = profile_probability::even ();
- 
-   tree tmp;
--  gimple_seq stmts = gen_pow2p (index, UNKNOWN_LOCATION, &tmp,
--				m_exp_index_transform_pow2p_type);
-+  gimple_seq stmts = gen_pow2p (index, UNKNOWN_LOCATION, &tmp);
-   gsi = gsi_last_bb (cond_bb);
-   gsi_insert_seq_after (&gsi, stmts, GSI_LAST_NEW_STMT);
-   gcond *stmt_cond = gimple_build_cond (NE_EXPR, tmp, boolean_false_node,
-diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h
-index 14610499e5fb..6468995eb316 100644
---- a/gcc/tree-switch-conversion.h
-+++ b/gcc/tree-switch-conversion.h
-@@ -920,11 +920,9 @@ public:
-   bool m_exp_index_transform_applied;
- 
-   /* If switch conversion decided exponential index transform is viable, here
--     will be stored the types to which index variable has to be converted
--     before the logarithm and the "is power of 2" operations which are part of
--     the transform.  */
-+     will be stored the type to which index variable has to be converted
-+     before the logarithm operation which is a part of the transform.  */
-   tree m_exp_index_transform_log2_type;
--  tree m_exp_index_transform_pow2p_type;
- };
- 
- void
--- 
-2.46.2
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 819d192..d966e4c 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,6 +1,7 @@
 14	????
 
 	- 70_all_middle-end-check-explicitly-for-external-or-constant.patch
+	- 71_all_PR116878-libcall.patch
 
 13	29 September 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-04  9:28 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-04  9:28 UTC (permalink / raw
  To: gentoo-commits

commit:     f44cf391c1dbacd2651298e2fb366905a5fe0a06
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  4 09:27:50 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct  4 09:27:50 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f44cf391

15.0.0: add two C++ patches

+ 71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch
+ 72_all_c-Return-the-underlying-decl-rather-than-the-USING_D.patch

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

 ...erences-to-internal-linkage-vars-in-C-11-.patch | 96 ++++++++++++++++++++++
 ...e-underlying-decl-rather-than-the-USING_D.patch | 76 +++++++++++++++++
 15.0.0/gentoo/README.history                       |  4 +-
 3 files changed, 175 insertions(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch b/15.0.0/gentoo/71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch
new file mode 100644
index 0000000..4e2f1f4
--- /dev/null
+++ b/15.0.0/gentoo/71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch
@@ -0,0 +1,96 @@
+From 923bd335a44b1b556d705a7f1d36a2e9c06d9c5c Mon Sep 17 00:00:00 2001
+Message-ID: <923bd335a44b1b556d705a7f1d36a2e9c06d9c5c.1728034006.git.sam@gentoo.org>
+From: Nathaniel Shead <nathanieloshead@gmail.com>
+Date: Fri, 4 Oct 2024 12:41:49 +1000
+Subject: [PATCH 1/2] c++: Allow references to internal-linkage vars in C++11
+ [PR113266]
+
+[temp.arg.nontype] changed in C++11 to allow naming internal-linkage
+variables and functions.  We currently already handle internal-linkage
+functions, but variables were missed; this patch updates this.
+
+	PR c++/113266
+	PR c++/116911
+
+gcc/cp/ChangeLog:
+
+	* parser.cc (cp_parser_template_argument): Allow
+	internal-linkage variables since C++11.
+
+gcc/testsuite/ChangeLog:
+
+	* g++.dg/cpp0x/nontype6.C: New test.
+
+Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
+---
+ gcc/cp/parser.cc                      | 17 ++++++++++++-----
+ gcc/testsuite/g++.dg/cpp0x/nontype6.C | 19 +++++++++++++++++++
+ 2 files changed, 31 insertions(+), 5 deletions(-)
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/nontype6.C
+
+diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
+index 08f9c89f1f0..e758ddeb1d5 100644
+--- a/gcc/cp/parser.cc
++++ b/gcc/cp/parser.cc
+@@ -19864,9 +19864,11 @@ cp_parser_template_argument (cp_parser* parser)
+ 
+      -- the name of a non-type template-parameter; or
+ 
+-     -- the name of an object or function with external linkage...
++     -- the name of an object or function with external (or internal,
++	since C++11) linkage...
+ 
+-     -- the address of an object or function with external linkage...
++     -- the address of an object or function with external (or internal,
++	since C++11) linkage...
+ 
+      -- a pointer to member...  */
+   /* Look for a non-type template parameter.  */
+@@ -19929,11 +19931,16 @@ cp_parser_template_argument (cp_parser* parser)
+ 	    probe = TREE_OPERAND (probe, 1);
+ 	  if (VAR_P (probe))
+ 	    {
+-	      /* A variable without external linkage might still be a
++	      /* A variable without valid linkage might still be a
+ 		 valid constant-expression, so no error is issued here
+ 		 if the external-linkage check fails.  */
+-	      if (!address_p && !DECL_EXTERNAL_LINKAGE_P (probe))
+-		cp_parser_simulate_error (parser);
++	      if (!address_p && cxx_dialect < cxx17)
++		{
++		  linkage_kind linkage = decl_linkage (probe);
++		  if (linkage != lk_external
++		      && (cxx_dialect < cxx11 || linkage != lk_internal))
++		    cp_parser_simulate_error (parser);
++		}
+ 	    }
+ 	  else if (is_overloaded_fn (argument))
+ 	    /* All overloaded functions are allowed; if the external
+diff --git a/gcc/testsuite/g++.dg/cpp0x/nontype6.C b/gcc/testsuite/g++.dg/cpp0x/nontype6.C
+new file mode 100644
+index 00000000000..5543d1e8b6d
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/nontype6.C
+@@ -0,0 +1,19 @@
++// PR c++/113266, PR c++/116911
++// { dg-do compile }
++
++template <int &> struct a {};
++static int guard1;
++a<guard1> b;  // { dg-error "constant-expression|invalid" "" { target c++98_only } }
++
++namespace {
++  int guard2;
++}
++a<guard2> c;  // OK in C++98 because guard2 has external linkage
++              // OK since C++11 because we can refer to an internal linkage decl
++
++void nolinkage() {
++  static int guard3;
++  a<guard3> d;  // { dg-error "constant-expression|invalid" "" { target c++98_only } }
++  // { dg-error "constant expression|no linkage" "" { target { c++11 && c++14_down } } .-1 }
++  // OK since C++17 since we can now refer to no-linkage decls
++}
+-- 
+2.46.2
+

diff --git a/15.0.0/gentoo/72_all_c-Return-the-underlying-decl-rather-than-the-USING_D.patch b/15.0.0/gentoo/72_all_c-Return-the-underlying-decl-rather-than-the-USING_D.patch
new file mode 100644
index 0000000..ab12bf6
--- /dev/null
+++ b/15.0.0/gentoo/72_all_c-Return-the-underlying-decl-rather-than-the-USING_D.patch
@@ -0,0 +1,76 @@
+From ba7c4e109fc589603911630deb2f19eba88bdbe8 Mon Sep 17 00:00:00 2001
+Message-ID: <ba7c4e109fc589603911630deb2f19eba88bdbe8.1728034006.git.sam@gentoo.org>
+In-Reply-To: <923bd335a44b1b556d705a7f1d36a2e9c06d9c5c.1728034006.git.sam@gentoo.org>
+References: <923bd335a44b1b556d705a7f1d36a2e9c06d9c5c.1728034006.git.sam@gentoo.org>
+From: Nathaniel Shead <nathanieloshead@gmail.com>
+Date: Fri, 4 Oct 2024 10:52:02 +1000
+Subject: [PATCH 2/2] c++: Return the underlying decl rather than the
+ USING_DECL from update_binding [PR116913]
+
+Users of pushdecl assume that the returned decl will be a possibly
+updated decl matching the one that was passed in.  My r15-3910 change
+broke this since in some cases we would now return USING_DECLs; this
+patch fixes the situation.
+
+	PR c++/116913
+
+gcc/cp/ChangeLog:
+
+	* name-lookup.cc (update_binding): Return the strip_using'd old
+	decl rather than the binding.
+
+gcc/testsuite/ChangeLog:
+
+	* g++.dg/lookup/using70.C: New test.
+
+Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
+---
+ gcc/cp/name-lookup.cc                 |  4 ++--
+ gcc/testsuite/g++.dg/lookup/using70.C | 13 +++++++++++++
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+ create mode 100644 gcc/testsuite/g++.dg/lookup/using70.C
+
+diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc
+index 4754ef5a522..609bd6e8c9b 100644
+--- a/gcc/cp/name-lookup.cc
++++ b/gcc/cp/name-lookup.cc
+@@ -3101,7 +3101,7 @@ update_binding (cp_binding_level *level, cxx_binding *binding, tree *slot,
+ 	{
+ 	  if (same_type_p (TREE_TYPE (old), TREE_TYPE (decl)))
+ 	    /* Two type decls to the same type.  Do nothing.  */
+-	    return old_bval;
++	    return old;
+ 	  else
+ 	    goto conflict;
+ 	}
+@@ -3114,7 +3114,7 @@ update_binding (cp_binding_level *level, cxx_binding *binding, tree *slot,
+ 
+ 	  /* The new one must be an alias at this point.  */
+ 	  gcc_assert (DECL_NAMESPACE_ALIAS (decl));
+-	  return old_bval;
++	  return old;
+ 	}
+       else if (TREE_CODE (old) == VAR_DECL)
+ 	{
+diff --git a/gcc/testsuite/g++.dg/lookup/using70.C b/gcc/testsuite/g++.dg/lookup/using70.C
+new file mode 100644
+index 00000000000..14838eea7ec
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/lookup/using70.C
+@@ -0,0 +1,13 @@
++// PR c++/116913
++// { dg-do compile { target c++11 } }
++
++namespace ns {
++  struct c {};
++  using d = int;
++}
++
++using ns::c;
++using ns::d;
++
++using c = ns::c;
++using d = ns::d;
+-- 
+2.46.2
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index d966e4c..2d85dc2 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,7 +1,9 @@
-14	????
+14	4 October 2024
 
 	- 70_all_middle-end-check-explicitly-for-external-or-constant.patch
 	- 71_all_PR116878-libcall.patch
+	+ 71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch
+	+ 72_all_c-Return-the-underlying-decl-rather-than-the-USING_D.patch
 
 13	29 September 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-04 10:37 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-04 10:37 UTC (permalink / raw
  To: gentoo-commits

commit:     fd69f7a88e4fa1dd773750c0ce7a31c20f452ce2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  4 10:36:15 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct  4 10:36:57 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=fd69f7a8

15.0.0: drop patches merged upstream

- 71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch
- 72_all_c-Return-the-underlying-decl-rather-than-the-USING_D.patch

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

 ...erences-to-internal-linkage-vars-in-C-11-.patch | 96 ----------------------
 ...e-underlying-decl-rather-than-the-USING_D.patch | 76 -----------------
 15.0.0/gentoo/README.history                       |  5 ++
 3 files changed, 5 insertions(+), 172 deletions(-)

diff --git a/15.0.0/gentoo/71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch b/15.0.0/gentoo/71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch
deleted file mode 100644
index 4e2f1f4..0000000
--- a/15.0.0/gentoo/71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From 923bd335a44b1b556d705a7f1d36a2e9c06d9c5c Mon Sep 17 00:00:00 2001
-Message-ID: <923bd335a44b1b556d705a7f1d36a2e9c06d9c5c.1728034006.git.sam@gentoo.org>
-From: Nathaniel Shead <nathanieloshead@gmail.com>
-Date: Fri, 4 Oct 2024 12:41:49 +1000
-Subject: [PATCH 1/2] c++: Allow references to internal-linkage vars in C++11
- [PR113266]
-
-[temp.arg.nontype] changed in C++11 to allow naming internal-linkage
-variables and functions.  We currently already handle internal-linkage
-functions, but variables were missed; this patch updates this.
-
-	PR c++/113266
-	PR c++/116911
-
-gcc/cp/ChangeLog:
-
-	* parser.cc (cp_parser_template_argument): Allow
-	internal-linkage variables since C++11.
-
-gcc/testsuite/ChangeLog:
-
-	* g++.dg/cpp0x/nontype6.C: New test.
-
-Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
----
- gcc/cp/parser.cc                      | 17 ++++++++++++-----
- gcc/testsuite/g++.dg/cpp0x/nontype6.C | 19 +++++++++++++++++++
- 2 files changed, 31 insertions(+), 5 deletions(-)
- create mode 100644 gcc/testsuite/g++.dg/cpp0x/nontype6.C
-
-diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
-index 08f9c89f1f0..e758ddeb1d5 100644
---- a/gcc/cp/parser.cc
-+++ b/gcc/cp/parser.cc
-@@ -19864,9 +19864,11 @@ cp_parser_template_argument (cp_parser* parser)
- 
-      -- the name of a non-type template-parameter; or
- 
--     -- the name of an object or function with external linkage...
-+     -- the name of an object or function with external (or internal,
-+	since C++11) linkage...
- 
--     -- the address of an object or function with external linkage...
-+     -- the address of an object or function with external (or internal,
-+	since C++11) linkage...
- 
-      -- a pointer to member...  */
-   /* Look for a non-type template parameter.  */
-@@ -19929,11 +19931,16 @@ cp_parser_template_argument (cp_parser* parser)
- 	    probe = TREE_OPERAND (probe, 1);
- 	  if (VAR_P (probe))
- 	    {
--	      /* A variable without external linkage might still be a
-+	      /* A variable without valid linkage might still be a
- 		 valid constant-expression, so no error is issued here
- 		 if the external-linkage check fails.  */
--	      if (!address_p && !DECL_EXTERNAL_LINKAGE_P (probe))
--		cp_parser_simulate_error (parser);
-+	      if (!address_p && cxx_dialect < cxx17)
-+		{
-+		  linkage_kind linkage = decl_linkage (probe);
-+		  if (linkage != lk_external
-+		      && (cxx_dialect < cxx11 || linkage != lk_internal))
-+		    cp_parser_simulate_error (parser);
-+		}
- 	    }
- 	  else if (is_overloaded_fn (argument))
- 	    /* All overloaded functions are allowed; if the external
-diff --git a/gcc/testsuite/g++.dg/cpp0x/nontype6.C b/gcc/testsuite/g++.dg/cpp0x/nontype6.C
-new file mode 100644
-index 00000000000..5543d1e8b6d
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/cpp0x/nontype6.C
-@@ -0,0 +1,19 @@
-+// PR c++/113266, PR c++/116911
-+// { dg-do compile }
-+
-+template <int &> struct a {};
-+static int guard1;
-+a<guard1> b;  // { dg-error "constant-expression|invalid" "" { target c++98_only } }
-+
-+namespace {
-+  int guard2;
-+}
-+a<guard2> c;  // OK in C++98 because guard2 has external linkage
-+              // OK since C++11 because we can refer to an internal linkage decl
-+
-+void nolinkage() {
-+  static int guard3;
-+  a<guard3> d;  // { dg-error "constant-expression|invalid" "" { target c++98_only } }
-+  // { dg-error "constant expression|no linkage" "" { target { c++11 && c++14_down } } .-1 }
-+  // OK since C++17 since we can now refer to no-linkage decls
-+}
--- 
-2.46.2
-

diff --git a/15.0.0/gentoo/72_all_c-Return-the-underlying-decl-rather-than-the-USING_D.patch b/15.0.0/gentoo/72_all_c-Return-the-underlying-decl-rather-than-the-USING_D.patch
deleted file mode 100644
index ab12bf6..0000000
--- a/15.0.0/gentoo/72_all_c-Return-the-underlying-decl-rather-than-the-USING_D.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-From ba7c4e109fc589603911630deb2f19eba88bdbe8 Mon Sep 17 00:00:00 2001
-Message-ID: <ba7c4e109fc589603911630deb2f19eba88bdbe8.1728034006.git.sam@gentoo.org>
-In-Reply-To: <923bd335a44b1b556d705a7f1d36a2e9c06d9c5c.1728034006.git.sam@gentoo.org>
-References: <923bd335a44b1b556d705a7f1d36a2e9c06d9c5c.1728034006.git.sam@gentoo.org>
-From: Nathaniel Shead <nathanieloshead@gmail.com>
-Date: Fri, 4 Oct 2024 10:52:02 +1000
-Subject: [PATCH 2/2] c++: Return the underlying decl rather than the
- USING_DECL from update_binding [PR116913]
-
-Users of pushdecl assume that the returned decl will be a possibly
-updated decl matching the one that was passed in.  My r15-3910 change
-broke this since in some cases we would now return USING_DECLs; this
-patch fixes the situation.
-
-	PR c++/116913
-
-gcc/cp/ChangeLog:
-
-	* name-lookup.cc (update_binding): Return the strip_using'd old
-	decl rather than the binding.
-
-gcc/testsuite/ChangeLog:
-
-	* g++.dg/lookup/using70.C: New test.
-
-Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
----
- gcc/cp/name-lookup.cc                 |  4 ++--
- gcc/testsuite/g++.dg/lookup/using70.C | 13 +++++++++++++
- 2 files changed, 15 insertions(+), 2 deletions(-)
- create mode 100644 gcc/testsuite/g++.dg/lookup/using70.C
-
-diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc
-index 4754ef5a522..609bd6e8c9b 100644
---- a/gcc/cp/name-lookup.cc
-+++ b/gcc/cp/name-lookup.cc
-@@ -3101,7 +3101,7 @@ update_binding (cp_binding_level *level, cxx_binding *binding, tree *slot,
- 	{
- 	  if (same_type_p (TREE_TYPE (old), TREE_TYPE (decl)))
- 	    /* Two type decls to the same type.  Do nothing.  */
--	    return old_bval;
-+	    return old;
- 	  else
- 	    goto conflict;
- 	}
-@@ -3114,7 +3114,7 @@ update_binding (cp_binding_level *level, cxx_binding *binding, tree *slot,
- 
- 	  /* The new one must be an alias at this point.  */
- 	  gcc_assert (DECL_NAMESPACE_ALIAS (decl));
--	  return old_bval;
-+	  return old;
- 	}
-       else if (TREE_CODE (old) == VAR_DECL)
- 	{
-diff --git a/gcc/testsuite/g++.dg/lookup/using70.C b/gcc/testsuite/g++.dg/lookup/using70.C
-new file mode 100644
-index 00000000000..14838eea7ec
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/lookup/using70.C
-@@ -0,0 +1,13 @@
-+// PR c++/116913
-+// { dg-do compile { target c++11 } }
-+
-+namespace ns {
-+  struct c {};
-+  using d = int;
-+}
-+
-+using ns::c;
-+using ns::d;
-+
-+using c = ns::c;
-+using d = ns::d;
--- 
-2.46.2
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 2d85dc2..f58b501 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,8 @@
+15	????
+
+	- 71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch
+	- 72_all_c-Return-the-underlying-decl-rather-than-the-USING_D.patch
+
 14	4 October 2024
 
 	- 70_all_middle-end-check-explicitly-for-external-or-constant.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-07  2:45 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-07  2:45 UTC (permalink / raw
  To: gentoo-commits

commit:     9a259e1746b11f94c3ccdeacb33bcc9ccfeb3f5f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  7 02:45:18 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct  7 02:45:18 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9a259e17

15.0.0: cut patchset 15

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index f58b501..a6954a6 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-15	????
+15	7 October 2024
 
 	- 71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch
 	- 72_all_c-Return-the-underlying-decl-rather-than-the-USING_D.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-13 22:48 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-13 22:48 UTC (permalink / raw
  To: gentoo-commits

commit:     b4a852b00ffc7c9436d15867d602c28837c97758
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 22:47:21 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 22:47:21 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b4a852b0

15.0.0: add two coro patches

Bug: https://gcc.gnu.org/PR116506
Bug: https://gcc.gnu.org/PR116914
Closes: https://bugs.gentoo.org/941147
Closes: https://bugs.gentoo.org/941148
Signed-off-by: Sam James <sam <AT> gentoo.org>

 15.0.0/gentoo/70_all_PR116506-coro.patch | 295 +++++++++++++++++++++++++++++++
 15.0.0/gentoo/71_all_PR116914-coro.patch |  51 ++++++
 15.0.0/gentoo/README.history             |   5 +
 3 files changed, 351 insertions(+)

diff --git a/15.0.0/gentoo/70_all_PR116506-coro.patch b/15.0.0/gentoo/70_all_PR116506-coro.patch
new file mode 100644
index 0000000..4e670fc
--- /dev/null
+++ b/15.0.0/gentoo/70_all_PR116506-coro.patch
@@ -0,0 +1,295 @@
+From 06475fcc5b72fdb9b24e7e39703942e1e3f2f0d5 Mon Sep 17 00:00:00 2001
+From: Iain Sandoe <iain@sandoe.co.uk>
+Date: Thu, 29 Aug 2024 11:18:24 +0100
+Subject: [PATCH] c++, coroutines: Fix awaiter var creation [PR116506].
+
+Awaiters always need to have a coroutine state frame copy since
+they persist across potential supensions.  It simplifies the later
+analysis considerably to assign these early which we do when
+building co_await expressions.
+
+The cleanups in r15-3146-g47dbd69b1, unfortunately elided some of
+processing used to cater for cases where the var created from an
+xvalue, or is a pointer/reference type.
+
+Corrected thus.
+
+	PR c++/116506
+	PR c++/116880
+
+gcc/cp/ChangeLog:
+
+	* coroutines.cc (build_co_await): Ensure that xvalues are
+	materialised.  Handle references/pointer values in awaiter
+	access expressions.
+
+gcc/testsuite/ChangeLog:
+
+	* g++.dg/coroutines/pr116506.C: New test.
+	* g++.dg/coroutines/pr116880.C: New test.
+
+Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
+---
+ gcc/cp/coroutines.cc                       | 82 +++++++++++++++++-----
+ gcc/testsuite/g++.dg/coroutines/pr116506.C | 53 ++++++++++++++
+ gcc/testsuite/g++.dg/coroutines/pr116880.C | 36 ++++++++++
+ 3 files changed, 154 insertions(+), 17 deletions(-)
+ create mode 100644 gcc/testsuite/g++.dg/coroutines/pr116506.C
+ create mode 100644 gcc/testsuite/g++.dg/coroutines/pr116880.C
+
+diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
+index 86a5ac8999a..ba6ee41a4e7 100644
+--- a/gcc/cp/coroutines.cc
++++ b/gcc/cp/coroutines.cc
+@@ -1071,6 +1071,30 @@ build_template_co_await_expr (location_t kw, tree type, tree expr, tree kind)
+   return aw_expr;
+ }
+ 
++/* For a component ref that is not a pointer type, decide if we can use
++   this directly.  */
++static bool
++usable_component_ref (tree comp_ref)
++{
++  if (TREE_CODE (comp_ref) != COMPONENT_REF
++      || TREE_SIDE_EFFECTS (comp_ref))
++    return false;
++
++  while (TREE_CODE (comp_ref) == COMPONENT_REF)
++    {
++      comp_ref = TREE_OPERAND (comp_ref, 0);
++      STRIP_NOPS (comp_ref);
++      /* x-> */
++      if (INDIRECT_REF_P (comp_ref))
++	return false;
++      /* operator-> */
++      if (TREE_CODE (comp_ref) == CALL_EXPR)
++	return false;
++      STRIP_NOPS (comp_ref);
++    }
++  gcc_checking_assert (VAR_P (comp_ref) || TREE_CODE (comp_ref) == PARM_DECL);
++  return true;
++}
+ 
+ /*  This performs [expr.await] bullet 3.3 and validates the interface obtained.
+     It is also used to build the initial and final suspend points.
+@@ -1133,13 +1157,12 @@ build_co_await (location_t loc, tree a, suspend_point_kind suspend_kind,
+   if (o_type && !VOID_TYPE_P (o_type))
+     o_type = complete_type_or_else (o_type, o);
+ 
+-  if (!o_type)
++  if (!o_type || o_type == error_mark_node)
+     return error_mark_node;
+ 
+   if (TREE_CODE (o_type) != RECORD_TYPE)
+     {
+-      error_at (loc, "awaitable type %qT is not a structure",
+-		o_type);
++      error_at (loc, "awaitable type %qT is not a structure", o_type);
+       return error_mark_node;
+     }
+ 
+@@ -1165,20 +1188,47 @@ build_co_await (location_t loc, tree a, suspend_point_kind suspend_kind,
+   if (!glvalue_p (o))
+     o = get_target_expr (o, tf_warning_or_error);
+ 
+-  tree e_proxy = o;
+-  if (glvalue_p (o))
++  /* We know that we need a coroutine state frame variable for the awaiter,
++     since it must persist across suspension; so where one is needed, build
++     it now.  */
++  tree e_proxy = STRIP_NOPS (o);
++  if (INDIRECT_REF_P (e_proxy))
++    e_proxy = TREE_OPERAND (e_proxy, 0);
++  o_type = TREE_TYPE (e_proxy);
++  bool is_ptr = TYPE_PTR_P (o_type);
++  if (!is_ptr
++      && (TREE_CODE (e_proxy) == PARM_DECL
++	  || usable_component_ref (e_proxy)
++	  || (VAR_P (e_proxy) && !is_local_temp (e_proxy))))
+     o = NULL_TREE; /* Use the existing entity.  */
+-  else /* We need to materialise it.  */
++  else /* We need a non-temp var.  */
+     {
+-      e_proxy = get_awaitable_var (suspend_kind, o_type);
+-      o = cp_build_init_expr (loc, e_proxy, o);
+-      e_proxy = convert_from_reference (e_proxy);
++      tree p_type = o_type;
++      tree o_a = o;
++      if (lvalue_p (o) && !TREE_SIDE_EFFECTS (o))
++	{
++	  if (is_ptr)
++	    p_type = TREE_TYPE (p_type);
++	  p_type = cp_build_reference_type (p_type, false);
++	  o_a = build_address (o);
++	}
++      if (INDIRECT_REF_P (o_a))
++	o_a = TREE_OPERAND (o_a, 0);
++      e_proxy = get_awaitable_var (suspend_kind, p_type);
++      o = cp_build_init_expr (loc, e_proxy, o_a);
+     }
+ 
++  /* Build an expression for the object that will be used to call the awaitable
++     methods.  */
++  tree e_object = convert_from_reference (e_proxy);
++  if (TYPE_PTR_P (TREE_TYPE (e_object)))
++    e_object = cp_build_indirect_ref (input_location, e_object, RO_UNARY_STAR,
++				      tf_warning_or_error);
++
+   /* I suppose we could check that this is contextually convertible to bool.  */
+   tree awrd_func = NULL_TREE;
+   tree awrd_call
+-    = build_new_method_call (e_proxy, awrd_meth, NULL, NULL_TREE, LOOKUP_NORMAL,
++    = build_new_method_call (e_object, awrd_meth, NULL, NULL_TREE, LOOKUP_NORMAL,
+ 			     &awrd_func, tf_warning_or_error);
+ 
+   if (!awrd_func || !awrd_call || awrd_call == error_mark_node)
+@@ -1192,7 +1242,7 @@ build_co_await (location_t loc, tree a, suspend_point_kind suspend_kind,
+   tree h_proxy = get_coroutine_self_handle_proxy (current_function_decl);
+   vec<tree, va_gc> *args = make_tree_vector_single (h_proxy);
+   tree awsp_call
+-    = build_new_method_call (e_proxy, awsp_meth, &args, NULL_TREE,
++    = build_new_method_call (e_object, awsp_meth, &args, NULL_TREE,
+ 			     LOOKUP_NORMAL, &awsp_func, tf_warning_or_error);
+ 
+   release_tree_vector (args);
+@@ -1224,7 +1274,7 @@ build_co_await (location_t loc, tree a, suspend_point_kind suspend_kind,
+   /* Finally, the type of e.await_resume() is the co_await's type.  */
+   tree awrs_func = NULL_TREE;
+   tree awrs_call
+-    = build_new_method_call (e_proxy, awrs_meth, NULL, NULL_TREE, LOOKUP_NORMAL,
++    = build_new_method_call (e_object, awrs_meth, NULL, NULL_TREE, LOOKUP_NORMAL,
+ 			     &awrs_func, tf_warning_or_error);
+ 
+   if (!awrs_func || !awrs_call || awrs_call == error_mark_node)
+@@ -1238,7 +1288,7 @@ build_co_await (location_t loc, tree a, suspend_point_kind suspend_kind,
+ 	return error_mark_node;
+       if (coro_diagnose_throwing_fn (awrs_func))
+ 	return error_mark_node;
+-      if (tree dummy = cxx_maybe_build_cleanup (e_proxy, tf_none))
++      if (tree dummy = cxx_maybe_build_cleanup (e_object, tf_none))
+ 	{
+ 	  if (CONVERT_EXPR_P (dummy))
+ 	    dummy = TREE_OPERAND (dummy, 0);
+@@ -1249,7 +1299,8 @@ build_co_await (location_t loc, tree a, suspend_point_kind suspend_kind,
+     }
+ 
+   /* We now have three call expressions, in terms of the promise, handle and
+-     'e' proxies.  Save them in the await expression for later expansion.  */
++     'e' proxy expression.  Save them in the await expression for later
++     expansion.  */
+ 
+   tree awaiter_calls = make_tree_vec (3);
+   TREE_VEC_ELT (awaiter_calls, 0) = awrd_call; /* await_ready().  */
+@@ -1262,9 +1313,6 @@ build_co_await (location_t loc, tree a, suspend_point_kind suspend_kind,
+     }
+   TREE_VEC_ELT (awaiter_calls, 2) = awrs_call; /* await_resume().  */
+ 
+-  if (REFERENCE_REF_P (e_proxy))
+-    e_proxy = TREE_OPERAND (e_proxy, 0);
+-
+   tree awrs_type = TREE_TYPE (TREE_TYPE (awrs_func));
+   tree suspend_kind_cst = build_int_cst (integer_type_node,
+ 					 (int) suspend_kind);
+diff --git a/gcc/testsuite/g++.dg/coroutines/pr116506.C b/gcc/testsuite/g++.dg/coroutines/pr116506.C
+new file mode 100644
+index 00000000000..57a6e360566
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/coroutines/pr116506.C
+@@ -0,0 +1,53 @@
++// { dg-do run }
++// { dg-additional-options "-fno-exceptions" }
++                                                       
++#include <coroutine>
++
++bool g_too_early = true;
++std::coroutine_handle<> g_handle;
++
++struct Awaiter {
++    Awaiter() {}
++    ~Awaiter() {
++        if (g_too_early) {
++            __builtin_abort ();
++        }
++    }
++
++    bool await_ready() { return false; }
++    void await_suspend(std::coroutine_handle<> handle) {
++        g_handle = handle;
++    }
++
++    void await_resume() {}
++};
++
++struct SuspendNever {
++    bool await_ready() noexcept { return true; }
++    void await_suspend(std::coroutine_handle<>) noexcept {}
++    void await_resume() noexcept {}
++};
++
++struct Coroutine {
++    struct promise_type {
++        Coroutine get_return_object() { return {}; }
++        SuspendNever initial_suspend() { return {}; }
++        SuspendNever final_suspend() noexcept { return {}; }
++        void return_void() {}
++        void unhandled_exception() {}
++
++        Awaiter&& await_transform(Awaiter&& u) {
++            return static_cast<Awaiter&&>(u);
++        }
++    };
++};
++
++Coroutine foo() {
++    co_await Awaiter{};
++}
++
++int main() {
++    foo();
++    g_too_early = false;
++    g_handle.destroy();
++}
+diff --git a/gcc/testsuite/g++.dg/coroutines/pr116880.C b/gcc/testsuite/g++.dg/coroutines/pr116880.C
+new file mode 100644
+index 00000000000..f0db6a26044
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/coroutines/pr116880.C
+@@ -0,0 +1,36 @@
++#include <coroutine>
++
++struct promise_type;
++using handle_type = std::coroutine_handle<promise_type>;
++
++struct Co {
++    handle_type handle;
++    using promise_type = ::promise_type;
++
++    explicit Co(handle_type handle) : handle(handle) {}
++
++    bool await_ready() { return false; }
++    std::coroutine_handle<> await_suspend(handle_type handle);
++    void await_resume() {}
++};
++
++struct Done {};
++
++struct promise_type {
++    Co get_return_object();
++
++    std::suspend_always initial_suspend() { return {}; };
++    std::suspend_always final_suspend() noexcept { return {}; };
++    void return_value(Done) {}
++    void return_value(Co&&);
++    void unhandled_exception() { throw; };
++    Co&& await_transform(Co&& co) { return static_cast<Co&&>(co); }
++};
++
++Co tryToRun();
++
++Co init()
++{
++    co_await tryToRun();
++    co_return Done{};
++}
+-- 
+2.39.2 (Apple Git-143)

diff --git a/15.0.0/gentoo/71_all_PR116914-coro.patch b/15.0.0/gentoo/71_all_PR116914-coro.patch
new file mode 100644
index 0000000..100d2bb
--- /dev/null
+++ b/15.0.0/gentoo/71_all_PR116914-coro.patch
@@ -0,0 +1,51 @@
+From 1035866a75b27bb2cac49bac1070877d95f7d3c0 Mon Sep 17 00:00:00 2001
+From: Iain Sandoe <iain@sandoe.co.uk>
+Date: Sun, 29 Sep 2024 10:04:39 +0100
+Subject: [PATCH] c++, coroutines: stmt expressions some progress
+
+---
+ gcc/cp/coroutines.cc | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
+index af8798b04ba..94bfa6ac450 100644
+--- a/gcc/cp/coroutines.cc
++++ b/gcc/cp/coroutines.cc
+@@ -2131,6 +2131,14 @@ await_statement_expander (tree *stmt, int *do_subtree, void *d)
+     }
+   else if (EXPR_P (*stmt))
+     {
++      /* Look for ({}) at the top level - just recurse into these.  */
++      if (TREE_CODE (*stmt) == EXPR_STMT)
++	{
++	  tree inner = EXPR_STMT_EXPR (*stmt);
++	  if (TREE_CODE (inner) == STATEMENT_LIST
++	      || TREE_CODE (inner) == BIND_EXPR)
++	    return NULL_TREE; // process contents
++	}
+       process_one_statement (stmt, d);
+       *do_subtree = 0; /* Done subtrees.  */
+     }
+@@ -3860,6 +3868,20 @@ await_statement_walker (tree *stmt, int *do_subtree, void *d)
+       if (!(cp_walk_tree (stmt, find_any_await, &await_ptr, &visited)))
+ 	return NULL_TREE; /* Nothing special to do here.  */
+ 
++      /* Handle statement expressions.  */
++      if (TREE_CODE (expr) == EXPR_STMT)
++	{
++	  tree inner = EXPR_STMT_EXPR (expr);
++	  if (TREE_CODE (inner) == STATEMENT_LIST
++	      || TREE_CODE (inner) == BIND_EXPR)
++	    {
++	      res = cp_walk_tree (&EXPR_STMT_EXPR (expr),
++				  await_statement_walker, d, NULL);
++	      *do_subtree = 0;
++	      return res;
++	    }
++	}
++
+       visited.empty ();
+       awpts->saw_awaits = 0;
+       hash_set<tree> truth_aoif_to_expand;
+-- 
+2.39.2 (Apple Git-143)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index a6954a6..073283d 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,8 @@
+16	13 October 2024
+
+	+ 70_all_PR116506-coro.patch
+	+ 71_all_PR116914-coro.patch
+
 15	7 October 2024
 
 	- 71_all_c-Allow-references-to-internal-linkage-vars-in-C-11-.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-17  4:15 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-17  4:15 UTC (permalink / raw
  To: gentoo-commits

commit:     63001509ff89680da88fd497486bcb3add0c4f65
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 17 04:15:08 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 17 04:15:08 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=63001509

15.0.0: add 72_all_PR117177-libcpp.patch

Fixes building glibc. Approved upstream but not yet merged.

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

 15.0.0/gentoo/72_all_PR117177-libcpp.patch | 234 +++++++++++++++++++++++++++++
 1 file changed, 234 insertions(+)

diff --git a/15.0.0/gentoo/72_all_PR117177-libcpp.patch b/15.0.0/gentoo/72_all_PR117177-libcpp.patch
new file mode 100644
index 0000000..1db42c9
--- /dev/null
+++ b/15.0.0/gentoo/72_all_PR117177-libcpp.patch
@@ -0,0 +1,234 @@
+From b2681b59424dd3a5fdf4101f8cc9eff60a5166b7 Mon Sep 17 00:00:00 2001
+Message-ID: <b2681b59424dd3a5fdf4101f8cc9eff60a5166b7.1729138476.git.sam@gentoo.org>
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Wed, 16 Oct 2024 23:09:32 +0200
+Subject: [PATCH] c: Fix up speed up compilation of large char array
+ initializers when not using #embed [PR117177]
+
+Hi!
+
+Apparently my
+c: Speed up compilation of large char array initializers when not using #embed
+patch broke building glibc.
+
+The issue is that when using CPP_EMBED, we are guaranteed by the
+preprocessor that there is CPP_NUMBER CPP_COMMA before it and
+CPP_COMMA CPP_NUMBER after it (or CPP_COMMA CPP_EMBED), so RAW_DATA_CST
+never ends up at the end of arrays of unknown length.
+Now, the c_parser_initval optimization attempted to preserve that property
+rather than changing everything that e.g. inferes array number of elements
+from the initializer etc. to deal with RAW_DATA_CST at the end, but
+it didn't take into account the possibility that there could be
+CPP_COMMA followed by CPP_CLOSE_BRACE (where the CPP_COMMA is redundant).
+
+As we are peaking already at 4 tokens in that code, peeking more would
+require using raw tokens and that seems to be expensive doing it for
+every pair of tokens due to vec_free done when we are out of raw tokens.
+
+So, the following patch instead determines the case where we want
+another INTEGER_CST element after it after consuming the tokens, and just
+arranges for another process_init_element.
+
+Ok for trunk if this passes bootstrap/regtest?
+
+2024-10-16  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c/117177
+gcc/c/
+	* c-parser.cc (c_parser_initval): Instead of doing
+	orig_len == INT_MAX checks before consuming tokens to set
+	last = 1, check it after consuming it and if not followed
+	by CPP_COMMA CPP_NUMBER, call process_init_element once
+	more with the last CPP_NUMBER.
+gcc/testsuite/
+	* c-c++-common/init-4.c: New test.
+---
+ gcc/c/c-parser.cc                   | 35 ++++++++---
+ gcc/testsuite/c-c++-common/init-4.c | 97 +++++++++++++++++++++++++++++
+ 2 files changed, 122 insertions(+), 10 deletions(-)
+ create mode 100644 gcc/testsuite/c-c++-common/init-4.c
+
+diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
+index e4381044e5c..090ab1cbc08 100644
+--- a/gcc/c/c-parser.cc
++++ b/gcc/c/c-parser.cc
+@@ -6529,6 +6529,7 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	unsigned int i;
+ 	gcc_checking_assert (len >= 64);
+ 	location_t last_loc = UNKNOWN_LOCATION;
++	location_t prev_loc = UNKNOWN_LOCATION;
+ 	for (i = 0; i < 64; ++i)
+ 	  {
+ 	    c_token *tok = c_parser_peek_nth_token_raw (parser, 1 + 2 * i);
+@@ -6544,6 +6545,7 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	    buf1[i] = (char) tree_to_uhwi (tok->value);
+ 	    if (i == 0)
+ 	      loc = tok->location;
++	    prev_loc = last_loc;
+ 	    last_loc = tok->location;
+ 	  }
+ 	if (i < 64)
+@@ -6567,6 +6569,7 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	unsigned int max_len = 131072 - offsetof (struct tree_string, str) - 1;
+ 	unsigned int orig_len = len;
+ 	unsigned int off = 0, last = 0;
++	unsigned char lastc = 0;
+ 	if (!wi::neg_p (wi::to_wide (val)) && wi::to_widest (val) <= UCHAR_MAX)
+ 	  off = 1;
+ 	len = MIN (len, max_len - off);
+@@ -6596,20 +6599,25 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	    if (tok2->type != CPP_COMMA && tok2->type != CPP_CLOSE_BRACE)
+ 	      break;
+ 	    buf2[i + off] = (char) tree_to_uhwi (tok->value);
+-	    /* If orig_len is INT_MAX, this can be flexible array member and
+-	       in that case we need to ensure another element which
+-	       for CPP_EMBED is normally guaranteed after it.  Include
+-	       that byte in the RAW_DATA_OWNER though, so it can be optimized
+-	       later.  */
+-	    if (tok2->type == CPP_CLOSE_BRACE && orig_len == INT_MAX)
+-	      {
+-		last = 1;
+-		break;
+-	      }
++	    prev_loc = last_loc;
+ 	    last_loc = tok->location;
+ 	    c_parser_consume_token (parser);
+ 	    c_parser_consume_token (parser);
+ 	  }
++	/* If orig_len is INT_MAX, this can be flexible array member and
++	   in that case we need to ensure another element which
++	   for CPP_EMBED is normally guaranteed after it.  Include
++	   that byte in the RAW_DATA_OWNER though, so it can be optimized
++	   later.  */
++	if (orig_len == INT_MAX
++	    && (!c_parser_next_token_is (parser, CPP_COMMA)
++		|| c_parser_peek_2nd_token (parser)->type != CPP_NUMBER))
++	  {
++	    --i;
++	    last = 1;
++	    std::swap (prev_loc, last_loc);
++	    lastc = (unsigned char) buf2[i + off];
++	  }
+ 	val = make_node (RAW_DATA_CST);
+ 	TREE_TYPE (val) = integer_type_node;
+ 	RAW_DATA_LENGTH (val) = i;
+@@ -6625,6 +6633,13 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	init.original_type = integer_type_node;
+ 	init.m_decimal = 0;
+ 	process_init_element (loc, init, false, braced_init_obstack);
++	if (last)
++	  {
++	    init.value = build_int_cst (integer_type_node, lastc);
++	    init.original_code = INTEGER_CST;
++	    set_c_expr_source_range (&init, prev_loc, prev_loc);
++	    process_init_element (prev_loc, init, false, braced_init_obstack);
++	  }
+       }
+ }
+ 
+diff --git a/gcc/testsuite/c-c++-common/init-4.c b/gcc/testsuite/c-c++-common/init-4.c
+new file mode 100644
+index 00000000000..d575a3f5a51
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/init-4.c
+@@ -0,0 +1,97 @@
++/* { dg-do run } */
++/* { dg-options "-O2" } */
++
++unsigned char a1[] = {
++  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
++  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
++  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
++  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
++  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
++  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
++  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
++  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
++  0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++};
++unsigned char a2[] = {
++  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
++  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
++  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
++  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
++  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
++  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
++  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
++  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00
++};
++unsigned char a3[] = {
++  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
++  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
++  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
++  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
++  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
++  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
++  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
++  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
++};
++unsigned char a4[] = {
++  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
++  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
++  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
++  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
++  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
++  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
++  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
++  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
++  0xfa
++};
++unsigned char a5[] = {
++  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
++  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
++  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
++  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
++  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
++  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
++  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
++  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
++  0xfa,
++};
++unsigned char a6[] = {
++  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
++  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
++  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
++  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
++  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
++  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
++  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
++  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
++  0xfa, 0xfb
++};
++unsigned char a7[] = {
++  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
++  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
++  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
++  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
++  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
++  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
++  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
++  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
++  0xfa, 0xfb
++};
++
++int
++main ()
++{
++  if (sizeof (a1) != 72
++      || sizeof (a2) != 64
++      || __builtin_memcmp (a1, a2, 64) != 0
++      || sizeof (a3) != 64
++      || __builtin_memcmp (a1, a3, 64) != 0
++      || sizeof (a4) != 65
++      || __builtin_memcmp (a1, a4, 65) != 0
++      || sizeof (a5) != 65
++      || __builtin_memcmp (a1, a5, 65) != 0
++      || sizeof (a6) != 66
++      || __builtin_memcmp (a1, a6, 66) != 0
++      || sizeof (a7) != 66
++      || __builtin_memcmp (a1, a7, 66) != 0)
++    __builtin_abort ();
++}
+-- 
+2.47.0
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-17  5:01 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-17  5:01 UTC (permalink / raw
  To: gentoo-commits

commit:     15d55a133c02c17eb73a729f098a0b6fa6e70632
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 17 05:00:54 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 17 05:00:54 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=15d55a13

15.0.0: drop 72_all_PR117177-libcpp.patch

Now merged upstream.

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

 15.0.0/gentoo/72_all_PR117177-libcpp.patch | 234 -----------------------------
 1 file changed, 234 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR117177-libcpp.patch b/15.0.0/gentoo/72_all_PR117177-libcpp.patch
deleted file mode 100644
index 1db42c9..0000000
--- a/15.0.0/gentoo/72_all_PR117177-libcpp.patch
+++ /dev/null
@@ -1,234 +0,0 @@
-From b2681b59424dd3a5fdf4101f8cc9eff60a5166b7 Mon Sep 17 00:00:00 2001
-Message-ID: <b2681b59424dd3a5fdf4101f8cc9eff60a5166b7.1729138476.git.sam@gentoo.org>
-From: Jakub Jelinek <jakub@redhat.com>
-Date: Wed, 16 Oct 2024 23:09:32 +0200
-Subject: [PATCH] c: Fix up speed up compilation of large char array
- initializers when not using #embed [PR117177]
-
-Hi!
-
-Apparently my
-c: Speed up compilation of large char array initializers when not using #embed
-patch broke building glibc.
-
-The issue is that when using CPP_EMBED, we are guaranteed by the
-preprocessor that there is CPP_NUMBER CPP_COMMA before it and
-CPP_COMMA CPP_NUMBER after it (or CPP_COMMA CPP_EMBED), so RAW_DATA_CST
-never ends up at the end of arrays of unknown length.
-Now, the c_parser_initval optimization attempted to preserve that property
-rather than changing everything that e.g. inferes array number of elements
-from the initializer etc. to deal with RAW_DATA_CST at the end, but
-it didn't take into account the possibility that there could be
-CPP_COMMA followed by CPP_CLOSE_BRACE (where the CPP_COMMA is redundant).
-
-As we are peaking already at 4 tokens in that code, peeking more would
-require using raw tokens and that seems to be expensive doing it for
-every pair of tokens due to vec_free done when we are out of raw tokens.
-
-So, the following patch instead determines the case where we want
-another INTEGER_CST element after it after consuming the tokens, and just
-arranges for another process_init_element.
-
-Ok for trunk if this passes bootstrap/regtest?
-
-2024-10-16  Jakub Jelinek  <jakub@redhat.com>
-
-	PR c/117177
-gcc/c/
-	* c-parser.cc (c_parser_initval): Instead of doing
-	orig_len == INT_MAX checks before consuming tokens to set
-	last = 1, check it after consuming it and if not followed
-	by CPP_COMMA CPP_NUMBER, call process_init_element once
-	more with the last CPP_NUMBER.
-gcc/testsuite/
-	* c-c++-common/init-4.c: New test.
----
- gcc/c/c-parser.cc                   | 35 ++++++++---
- gcc/testsuite/c-c++-common/init-4.c | 97 +++++++++++++++++++++++++++++
- 2 files changed, 122 insertions(+), 10 deletions(-)
- create mode 100644 gcc/testsuite/c-c++-common/init-4.c
-
-diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
-index e4381044e5c..090ab1cbc08 100644
---- a/gcc/c/c-parser.cc
-+++ b/gcc/c/c-parser.cc
-@@ -6529,6 +6529,7 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	unsigned int i;
- 	gcc_checking_assert (len >= 64);
- 	location_t last_loc = UNKNOWN_LOCATION;
-+	location_t prev_loc = UNKNOWN_LOCATION;
- 	for (i = 0; i < 64; ++i)
- 	  {
- 	    c_token *tok = c_parser_peek_nth_token_raw (parser, 1 + 2 * i);
-@@ -6544,6 +6545,7 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	    buf1[i] = (char) tree_to_uhwi (tok->value);
- 	    if (i == 0)
- 	      loc = tok->location;
-+	    prev_loc = last_loc;
- 	    last_loc = tok->location;
- 	  }
- 	if (i < 64)
-@@ -6567,6 +6569,7 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	unsigned int max_len = 131072 - offsetof (struct tree_string, str) - 1;
- 	unsigned int orig_len = len;
- 	unsigned int off = 0, last = 0;
-+	unsigned char lastc = 0;
- 	if (!wi::neg_p (wi::to_wide (val)) && wi::to_widest (val) <= UCHAR_MAX)
- 	  off = 1;
- 	len = MIN (len, max_len - off);
-@@ -6596,20 +6599,25 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	    if (tok2->type != CPP_COMMA && tok2->type != CPP_CLOSE_BRACE)
- 	      break;
- 	    buf2[i + off] = (char) tree_to_uhwi (tok->value);
--	    /* If orig_len is INT_MAX, this can be flexible array member and
--	       in that case we need to ensure another element which
--	       for CPP_EMBED is normally guaranteed after it.  Include
--	       that byte in the RAW_DATA_OWNER though, so it can be optimized
--	       later.  */
--	    if (tok2->type == CPP_CLOSE_BRACE && orig_len == INT_MAX)
--	      {
--		last = 1;
--		break;
--	      }
-+	    prev_loc = last_loc;
- 	    last_loc = tok->location;
- 	    c_parser_consume_token (parser);
- 	    c_parser_consume_token (parser);
- 	  }
-+	/* If orig_len is INT_MAX, this can be flexible array member and
-+	   in that case we need to ensure another element which
-+	   for CPP_EMBED is normally guaranteed after it.  Include
-+	   that byte in the RAW_DATA_OWNER though, so it can be optimized
-+	   later.  */
-+	if (orig_len == INT_MAX
-+	    && (!c_parser_next_token_is (parser, CPP_COMMA)
-+		|| c_parser_peek_2nd_token (parser)->type != CPP_NUMBER))
-+	  {
-+	    --i;
-+	    last = 1;
-+	    std::swap (prev_loc, last_loc);
-+	    lastc = (unsigned char) buf2[i + off];
-+	  }
- 	val = make_node (RAW_DATA_CST);
- 	TREE_TYPE (val) = integer_type_node;
- 	RAW_DATA_LENGTH (val) = i;
-@@ -6625,6 +6633,13 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	init.original_type = integer_type_node;
- 	init.m_decimal = 0;
- 	process_init_element (loc, init, false, braced_init_obstack);
-+	if (last)
-+	  {
-+	    init.value = build_int_cst (integer_type_node, lastc);
-+	    init.original_code = INTEGER_CST;
-+	    set_c_expr_source_range (&init, prev_loc, prev_loc);
-+	    process_init_element (prev_loc, init, false, braced_init_obstack);
-+	  }
-       }
- }
- 
-diff --git a/gcc/testsuite/c-c++-common/init-4.c b/gcc/testsuite/c-c++-common/init-4.c
-new file mode 100644
-index 00000000000..d575a3f5a51
---- /dev/null
-+++ b/gcc/testsuite/c-c++-common/init-4.c
-@@ -0,0 +1,97 @@
-+/* { dg-do run } */
-+/* { dg-options "-O2" } */
-+
-+unsigned char a1[] = {
-+  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
-+  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
-+  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
-+  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
-+  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
-+  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
-+  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
-+  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
-+  0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+};
-+unsigned char a2[] = {
-+  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
-+  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
-+  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
-+  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
-+  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
-+  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
-+  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
-+  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00
-+};
-+unsigned char a3[] = {
-+  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
-+  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
-+  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
-+  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
-+  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
-+  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
-+  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
-+  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
-+};
-+unsigned char a4[] = {
-+  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
-+  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
-+  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
-+  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
-+  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
-+  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
-+  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
-+  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
-+  0xfa
-+};
-+unsigned char a5[] = {
-+  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
-+  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
-+  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
-+  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
-+  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
-+  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
-+  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
-+  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
-+  0xfa,
-+};
-+unsigned char a6[] = {
-+  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
-+  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
-+  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
-+  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
-+  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
-+  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
-+  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
-+  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
-+  0xfa, 0xfb
-+};
-+unsigned char a7[] = {
-+  0xc8, 0xc9, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf,
-+  0x00, 0xd1, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7,
-+  0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf,
-+  0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0xe5, 0xe6, 0xe7,
-+  0xe8, 0xe9, 0xea, 0xeb, 0x00, 0xed, 0xee, 0xef,
-+  0x00, 0xf1, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7,
-+  0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff,
-+  0x00, 0x00, 0xc3, 0xe3, 0x00, 0x00, 0x00, 0x00,
-+  0xfa, 0xfb
-+};
-+
-+int
-+main ()
-+{
-+  if (sizeof (a1) != 72
-+      || sizeof (a2) != 64
-+      || __builtin_memcmp (a1, a2, 64) != 0
-+      || sizeof (a3) != 64
-+      || __builtin_memcmp (a1, a3, 64) != 0
-+      || sizeof (a4) != 65
-+      || __builtin_memcmp (a1, a4, 65) != 0
-+      || sizeof (a5) != 65
-+      || __builtin_memcmp (a1, a5, 65) != 0
-+      || sizeof (a6) != 66
-+      || __builtin_memcmp (a1, a6, 66) != 0
-+      || sizeof (a7) != 66
-+      || __builtin_memcmp (a1, a7, 66) != 0)
-+    __builtin_abort ();
-+}
--- 
-2.47.0
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-17 23:03 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-17 23:03 UTC (permalink / raw
  To: gentoo-commits

commit:     e1ed90a71415a98a6d4c7d6efe03b5e0551fbb4c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 17 23:02:59 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 17 23:02:59 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e1ed90a7

15.0.0: add 72_all_PR117192-andn.patch

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

 15.0.0/gentoo/72_all_PR117192-andn.patch | 94 ++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/15.0.0/gentoo/72_all_PR117192-andn.patch b/15.0.0/gentoo/72_all_PR117192-andn.patch
new file mode 100644
index 0000000..5593ae0
--- /dev/null
+++ b/15.0.0/gentoo/72_all_PR117192-andn.patch
@@ -0,0 +1,94 @@
+https://gcc.gnu.org/PR17192
+
+From 70f59d2a1c51bde085d8fc7df002918851e76c9c Mon Sep 17 00:00:00 2001
+From: "Cui, Lili" <lili.cui@intel.com>
+Date: Thu, 17 Oct 2024 08:50:38 +0800
+Subject: [PATCH] Support andn_optab for x86
+
+Add new andn pattern to match the new optab added by
+r15-1890-gf379596e0ba99d. Only enable 64bit, 128bit and
+256bit vector ANDN, X86-64 has mask mov instruction when
+avx512 is enabled.
+
+gcc/ChangeLog:
+
+	* config/i386/sse.md (andn<mode>3): New.
+	* config/i386/mmx.md (andn<mode>3): New.
+
+gcc/testsuite/ChangeLog:
+
+	* g++.target/i386/vect-cmp.C: New test.
+---
+ gcc/config/i386/mmx.md                   |  7 +++++++
+ gcc/config/i386/sse.md                   |  7 +++++++
+ gcc/testsuite/g++.target/i386/vect-cmp.C | 23 +++++++++++++++++++++++
+ 3 files changed, 37 insertions(+)
+ create mode 100644 gcc/testsuite/g++.target/i386/vect-cmp.C
+
+diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
+index 9d2a82c598e5..ef4ed8b501a1 100644
+--- a/gcc/config/i386/mmx.md
++++ b/gcc/config/i386/mmx.md
+@@ -4467,6 +4467,13 @@
+   operands[0] = lowpart_subreg (V16QImode, operands[0], <MODE>mode);
+ })
+ 
++(define_expand "andn<mode>3"
++  [(set (match_operand:MMXMODEI 0 "register_operand")
++        (and:MMXMODEI
++          (not:MMXMODEI (match_operand:MMXMODEI 1 "register_operand"))
++          (match_operand:MMXMODEI 2 "register_operand")))]
++  "TARGET_SSE2")
++
+ (define_insn "mmx_andnot<mode>3"
+   [(set (match_operand:MMXMODEI 0 "register_operand" "=y,x,x,v")
+ 	(and:MMXMODEI
+diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
+index a45b50ad7324..7be313346677 100644
+--- a/gcc/config/i386/sse.md
++++ b/gcc/config/i386/sse.md
+@@ -18438,6 +18438,13 @@
+ 	  (match_operand:VI_AVX2 2 "vector_operand")))]
+   "TARGET_SSE2")
+ 
++(define_expand "andn<mode>3"
++  [(set (match_operand:VI 0 "register_operand")
++	(and:VI
++	  (not:VI (match_operand:VI 2 "register_operand"))
++	  (match_operand:VI 1 "register_operand")))]
++  "TARGET_SSE2")
++
+ (define_expand "<sse2_avx2>_andnot<mode>3_mask"
+   [(set (match_operand:VI48_AVX512VL 0 "register_operand")
+ 	(vec_merge:VI48_AVX512VL
+diff --git a/gcc/testsuite/g++.target/i386/vect-cmp.C b/gcc/testsuite/g++.target/i386/vect-cmp.C
+new file mode 100644
+index 000000000000..c154474fa51c
+--- /dev/null
++++ b/gcc/testsuite/g++.target/i386/vect-cmp.C
+@@ -0,0 +1,23 @@
++/* { dg-do compile } */
++/* { dg-options "-O2 -march=x86-64-v3 -fdump-tree-optimized" } */
++
++#define vect8 __attribute__((vector_size(8) ))
++#define vect16 __attribute__((vector_size(16) ))
++#define vect32 __attribute__((vector_size(32) ))
++
++vect8 int bar0 (vect8 float a, vect8 float b, vect8 int c)
++{
++  return (a > b) ? 0 : c;
++}
++
++vect16 int bar1 (vect16 float a, vect16 float b, vect16 int c)
++{
++  return (a > b) ? 0 : c;
++}
++
++vect32 int bar2 (vect32 float a, vect32 float b, vect32 int c)
++{
++  return (a > b) ? 0 : c;
++}
++
++/* { dg-final { scan-tree-dump-times ".BIT_ANDN " 3 "optimized" { target { ! ia32 } } } } */
+-- 
+2.43.5


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-17 23:33 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-17 23:33 UTC (permalink / raw
  To: gentoo-commits

commit:     137934d3c0119acebb59614f6627e8b4fe299feb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 17 23:33:01 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 17 23:33:17 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=137934d3

15.0.0: fix 72_all_PR117192-andn.patch

Doh. Apply the patch, not the commit it's fixing...

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

 15.0.0/gentoo/72_all_PR117192-andn.patch | 98 ++++----------------------------
 1 file changed, 12 insertions(+), 86 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR117192-andn.patch b/15.0.0/gentoo/72_all_PR117192-andn.patch
index 5593ae0..f7706c1 100644
--- a/15.0.0/gentoo/72_all_PR117192-andn.patch
+++ b/15.0.0/gentoo/72_all_PR117192-andn.patch
@@ -1,94 +1,20 @@
 https://gcc.gnu.org/PR17192
-
-From 70f59d2a1c51bde085d8fc7df002918851e76c9c Mon Sep 17 00:00:00 2001
-From: "Cui, Lili" <lili.cui@intel.com>
-Date: Thu, 17 Oct 2024 08:50:38 +0800
-Subject: [PATCH] Support andn_optab for x86
-
-Add new andn pattern to match the new optab added by
-r15-1890-gf379596e0ba99d. Only enable 64bit, 128bit and
-256bit vector ANDN, X86-64 has mask mov instruction when
-avx512 is enabled.
-
-gcc/ChangeLog:
-
-	* config/i386/sse.md (andn<mode>3): New.
-	* config/i386/mmx.md (andn<mode>3): New.
-
-gcc/testsuite/ChangeLog:
-
-	* g++.target/i386/vect-cmp.C: New test.
----
- gcc/config/i386/mmx.md                   |  7 +++++++
- gcc/config/i386/sse.md                   |  7 +++++++
- gcc/testsuite/g++.target/i386/vect-cmp.C | 23 +++++++++++++++++++++++
- 3 files changed, 37 insertions(+)
- create mode 100644 gcc/testsuite/g++.target/i386/vect-cmp.C
+https://gcc.gnu.org/bugzilla/attachment.cgi?id=59373
 
 diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
-index 9d2a82c598e5..ef4ed8b501a1 100644
+index ef4ed8b501a..506f4cab6a8 100644
 --- a/gcc/config/i386/mmx.md
 +++ b/gcc/config/i386/mmx.md
-@@ -4467,6 +4467,13 @@
-   operands[0] = lowpart_subreg (V16QImode, operands[0], <MODE>mode);
- })
+@@ -4470,9 +4470,9 @@ (define_split
+ (define_expand "andn<mode>3"
+   [(set (match_operand:MMXMODEI 0 "register_operand")
+         (and:MMXMODEI
+-          (not:MMXMODEI (match_operand:MMXMODEI 1 "register_operand"))
+-          (match_operand:MMXMODEI 2 "register_operand")))]
+-  "TARGET_SSE2")
++          (not:MMXMODEI (match_operand:MMXMODEI 2 "register_operand"))
++          (match_operand:MMXMODEI 1 "register_operand")))]
++  "TARGET_MMX_WITH_SSE")
  
-+(define_expand "andn<mode>3"
-+  [(set (match_operand:MMXMODEI 0 "register_operand")
-+        (and:MMXMODEI
-+          (not:MMXMODEI (match_operand:MMXMODEI 1 "register_operand"))
-+          (match_operand:MMXMODEI 2 "register_operand")))]
-+  "TARGET_SSE2")
-+
  (define_insn "mmx_andnot<mode>3"
    [(set (match_operand:MMXMODEI 0 "register_operand" "=y,x,x,v")
- 	(and:MMXMODEI
-diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
-index a45b50ad7324..7be313346677 100644
---- a/gcc/config/i386/sse.md
-+++ b/gcc/config/i386/sse.md
-@@ -18438,6 +18438,13 @@
- 	  (match_operand:VI_AVX2 2 "vector_operand")))]
-   "TARGET_SSE2")
- 
-+(define_expand "andn<mode>3"
-+  [(set (match_operand:VI 0 "register_operand")
-+	(and:VI
-+	  (not:VI (match_operand:VI 2 "register_operand"))
-+	  (match_operand:VI 1 "register_operand")))]
-+  "TARGET_SSE2")
-+
- (define_expand "<sse2_avx2>_andnot<mode>3_mask"
-   [(set (match_operand:VI48_AVX512VL 0 "register_operand")
- 	(vec_merge:VI48_AVX512VL
-diff --git a/gcc/testsuite/g++.target/i386/vect-cmp.C b/gcc/testsuite/g++.target/i386/vect-cmp.C
-new file mode 100644
-index 000000000000..c154474fa51c
---- /dev/null
-+++ b/gcc/testsuite/g++.target/i386/vect-cmp.C
-@@ -0,0 +1,23 @@
-+/* { dg-do compile } */
-+/* { dg-options "-O2 -march=x86-64-v3 -fdump-tree-optimized" } */
-+
-+#define vect8 __attribute__((vector_size(8) ))
-+#define vect16 __attribute__((vector_size(16) ))
-+#define vect32 __attribute__((vector_size(32) ))
-+
-+vect8 int bar0 (vect8 float a, vect8 float b, vect8 int c)
-+{
-+  return (a > b) ? 0 : c;
-+}
-+
-+vect16 int bar1 (vect16 float a, vect16 float b, vect16 int c)
-+{
-+  return (a > b) ? 0 : c;
-+}
-+
-+vect32 int bar2 (vect32 float a, vect32 float b, vect32 int c)
-+{
-+  return (a > b) ? 0 : c;
-+}
-+
-+/* { dg-final { scan-tree-dump-times ".BIT_ANDN " 3 "optimized" { target { ! ia32 } } } } */
--- 
-2.43.5


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-18 10:35 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-18 10:35 UTC (permalink / raw
  To: gentoo-commits

commit:     462456df6da32e138cdc1e18df6e681cc2dc948a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 18 10:34:47 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 18 10:34:47 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=462456df

15.0.0: revert some embed patches

Do as Jakub suggests at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117190#c3
and revert these for now until a fix can be applied.

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

 ...x-up-speed-up-compilation-of-large-char-a.patch |  97 ++++++++++
 ...eed-up-compilation-of-large-char-array-in.patch | 212 +++++++++++++++++++++
 2 files changed, 309 insertions(+)

diff --git a/15.0.0/gentoo/73_all_PR117190-Revert-c-Fix-up-speed-up-compilation-of-large-char-a.patch b/15.0.0/gentoo/73_all_PR117190-Revert-c-Fix-up-speed-up-compilation-of-large-char-a.patch
new file mode 100644
index 0000000..47f26cc
--- /dev/null
+++ b/15.0.0/gentoo/73_all_PR117190-Revert-c-Fix-up-speed-up-compilation-of-large-char-a.patch
@@ -0,0 +1,97 @@
+From bfec21e6cf88b0b64bfcc30d2f5ae3b3370e36e3 Mon Sep 17 00:00:00 2001
+Message-ID: <bfec21e6cf88b0b64bfcc30d2f5ae3b3370e36e3.1729247640.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Fri, 18 Oct 2024 11:31:20 +0100
+Subject: [PATCH 1/2] Revert "c: Fix up speed up compilation of large char
+ array initializers when not using #embed [PR117177]"
+
+This reverts commit 96ba5e5663d4390a7e69735ce3c9de657fc543fc.
+
+Keep the testcase.
+
+Bug: https://gcc.gnu.org/PR117190
+---
+ gcc/c/c-parser.cc | 35 ++++++++++-------------------------
+ 1 file changed, 10 insertions(+), 25 deletions(-)
+
+diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
+index 090ab1cbc088..e4381044e5cb 100644
+--- a/gcc/c/c-parser.cc
++++ b/gcc/c/c-parser.cc
+@@ -6529,7 +6529,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	unsigned int i;
+ 	gcc_checking_assert (len >= 64);
+ 	location_t last_loc = UNKNOWN_LOCATION;
+-	location_t prev_loc = UNKNOWN_LOCATION;
+ 	for (i = 0; i < 64; ++i)
+ 	  {
+ 	    c_token *tok = c_parser_peek_nth_token_raw (parser, 1 + 2 * i);
+@@ -6545,7 +6544,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	    buf1[i] = (char) tree_to_uhwi (tok->value);
+ 	    if (i == 0)
+ 	      loc = tok->location;
+-	    prev_loc = last_loc;
+ 	    last_loc = tok->location;
+ 	  }
+ 	if (i < 64)
+@@ -6569,7 +6567,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	unsigned int max_len = 131072 - offsetof (struct tree_string, str) - 1;
+ 	unsigned int orig_len = len;
+ 	unsigned int off = 0, last = 0;
+-	unsigned char lastc = 0;
+ 	if (!wi::neg_p (wi::to_wide (val)) && wi::to_widest (val) <= UCHAR_MAX)
+ 	  off = 1;
+ 	len = MIN (len, max_len - off);
+@@ -6599,25 +6596,20 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	    if (tok2->type != CPP_COMMA && tok2->type != CPP_CLOSE_BRACE)
+ 	      break;
+ 	    buf2[i + off] = (char) tree_to_uhwi (tok->value);
+-	    prev_loc = last_loc;
++	    /* If orig_len is INT_MAX, this can be flexible array member and
++	       in that case we need to ensure another element which
++	       for CPP_EMBED is normally guaranteed after it.  Include
++	       that byte in the RAW_DATA_OWNER though, so it can be optimized
++	       later.  */
++	    if (tok2->type == CPP_CLOSE_BRACE && orig_len == INT_MAX)
++	      {
++		last = 1;
++		break;
++	      }
+ 	    last_loc = tok->location;
+ 	    c_parser_consume_token (parser);
+ 	    c_parser_consume_token (parser);
+ 	  }
+-	/* If orig_len is INT_MAX, this can be flexible array member and
+-	   in that case we need to ensure another element which
+-	   for CPP_EMBED is normally guaranteed after it.  Include
+-	   that byte in the RAW_DATA_OWNER though, so it can be optimized
+-	   later.  */
+-	if (orig_len == INT_MAX
+-	    && (!c_parser_next_token_is (parser, CPP_COMMA)
+-		|| c_parser_peek_2nd_token (parser)->type != CPP_NUMBER))
+-	  {
+-	    --i;
+-	    last = 1;
+-	    std::swap (prev_loc, last_loc);
+-	    lastc = (unsigned char) buf2[i + off];
+-	  }
+ 	val = make_node (RAW_DATA_CST);
+ 	TREE_TYPE (val) = integer_type_node;
+ 	RAW_DATA_LENGTH (val) = i;
+@@ -6633,13 +6625,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	init.original_type = integer_type_node;
+ 	init.m_decimal = 0;
+ 	process_init_element (loc, init, false, braced_init_obstack);
+-	if (last)
+-	  {
+-	    init.value = build_int_cst (integer_type_node, lastc);
+-	    init.original_code = INTEGER_CST;
+-	    set_c_expr_source_range (&init, prev_loc, prev_loc);
+-	    process_init_element (prev_loc, init, false, braced_init_obstack);
+-	  }
+       }
+ }
+ 
+-- 
+2.47.0
+

diff --git a/15.0.0/gentoo/74_all_PR117190-Revert-c-Speed-up-compilation-of-large-char-array-in.patch b/15.0.0/gentoo/74_all_PR117190-Revert-c-Speed-up-compilation-of-large-char-array-in.patch
new file mode 100644
index 0000000..889c961
--- /dev/null
+++ b/15.0.0/gentoo/74_all_PR117190-Revert-c-Speed-up-compilation-of-large-char-array-in.patch
@@ -0,0 +1,212 @@
+From ec2844301e40a017a32b4f11f499d6db7629c6bf Mon Sep 17 00:00:00 2001
+Message-ID: <ec2844301e40a017a32b4f11f499d6db7629c6bf.1729247640.git.sam@gentoo.org>
+In-Reply-To: <bfec21e6cf88b0b64bfcc30d2f5ae3b3370e36e3.1729247640.git.sam@gentoo.org>
+References: <bfec21e6cf88b0b64bfcc30d2f5ae3b3370e36e3.1729247640.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Fri, 18 Oct 2024 11:31:27 +0100
+Subject: [PATCH 2/2] Revert "c: Speed up compilation of large char array
+ initializers when not using #embed"
+
+This reverts commit f9bac238840155e1539aa68daf1507ea63c9ed80.
+
+Keep the testcase.
+
+Bug: https://gcc.gnu.org/PR117190
+---
+ gcc/c/c-parser.cc | 118 ----------------------------------------------
+ gcc/c/c-tree.h    |   1 -
+ gcc/c/c-typeck.cc |  36 --------------
+ 3 files changed, 155 deletions(-)
+
+diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
+index e4381044e5cb..9518459a0a57 100644
+--- a/gcc/c/c-parser.cc
++++ b/gcc/c/c-parser.cc
+@@ -6507,125 +6507,7 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 					    (init.value))))
+ 	init = convert_lvalue_to_rvalue (loc, init, true, true, true);
+     }
+-  tree val = init.value;
+   process_init_element (loc, init, false, braced_init_obstack);
+-
+-  /* Attempt to optimize large char array initializers into RAW_DATA_CST
+-     to save compile time and memory even when not using #embed.  */
+-  static unsigned vals_to_ignore;
+-  if (vals_to_ignore)
+-    /* If earlier call determined there is certain number of CPP_COMMA
+-       CPP_NUMBER tokens with 0-255 int values, but not enough for
+-       RAW_DATA_CST to be beneficial, don't try to check it again until
+-       they are all parsed.  */
+-    --vals_to_ignore;
+-  else if (val
+-	   && TREE_CODE (val) == INTEGER_CST
+-	   && TREE_TYPE (val) == integer_type_node
+-	   && c_parser_next_token_is (parser, CPP_COMMA))
+-    if (unsigned int len = c_maybe_optimize_large_byte_initializer ())
+-      {
+-	char buf1[64];
+-	unsigned int i;
+-	gcc_checking_assert (len >= 64);
+-	location_t last_loc = UNKNOWN_LOCATION;
+-	for (i = 0; i < 64; ++i)
+-	  {
+-	    c_token *tok = c_parser_peek_nth_token_raw (parser, 1 + 2 * i);
+-	    if (tok->type != CPP_COMMA)
+-	      break;
+-	    tok = c_parser_peek_nth_token_raw (parser, 2 + 2 * i);
+-	    if (tok->type != CPP_NUMBER
+-		|| TREE_CODE (tok->value) != INTEGER_CST
+-		|| TREE_TYPE (tok->value) != integer_type_node
+-		|| wi::neg_p (wi::to_wide (tok->value))
+-		|| wi::to_widest (tok->value) > UCHAR_MAX)
+-	      break;
+-	    buf1[i] = (char) tree_to_uhwi (tok->value);
+-	    if (i == 0)
+-	      loc = tok->location;
+-	    last_loc = tok->location;
+-	  }
+-	if (i < 64)
+-	  {
+-	    vals_to_ignore = i;
+-	    return;
+-	  }
+-	c_token *tok = c_parser_peek_nth_token_raw (parser, 1 + 2 * i);
+-	/* If 64 CPP_COMMA CPP_NUMBER pairs are followed by CPP_CLOSE_BRACE,
+-	   punt if len is INT_MAX as that can mean this is a flexible array
+-	   member and in that case we need one CPP_NUMBER afterwards
+-	   (as guaranteed for CPP_EMBED).  */
+-	if (tok->type == CPP_CLOSE_BRACE && len != INT_MAX)
+-	  len = i;
+-	else if (tok->type != CPP_COMMA)
+-	  {
+-	    vals_to_ignore = i;
+-	    return;
+-	  }
+-	/* Ensure the STRING_CST fits into 128K.  */
+-	unsigned int max_len = 131072 - offsetof (struct tree_string, str) - 1;
+-	unsigned int orig_len = len;
+-	unsigned int off = 0, last = 0;
+-	if (!wi::neg_p (wi::to_wide (val)) && wi::to_widest (val) <= UCHAR_MAX)
+-	  off = 1;
+-	len = MIN (len, max_len - off);
+-	char *buf2 = XNEWVEC (char, len + off);
+-	if (off)
+-	  buf2[0] = (char) tree_to_uhwi (val);
+-	memcpy (buf2 + off, buf1, i);
+-	for (unsigned int j = 0; j < i; ++j)
+-	  {
+-	    c_parser_peek_token (parser);
+-	    c_parser_consume_token (parser);
+-	    c_parser_peek_token (parser);
+-	    c_parser_consume_token (parser);
+-	  }
+-	for (; i < len; ++i)
+-	  {
+-	    if (!c_parser_next_token_is (parser, CPP_COMMA))
+-	      break;
+-	    tok = c_parser_peek_2nd_token (parser);
+-	    if (tok->type != CPP_NUMBER
+-		|| TREE_CODE (tok->value) != INTEGER_CST
+-		|| TREE_TYPE (tok->value) != integer_type_node
+-		|| wi::neg_p (wi::to_wide (tok->value))
+-		|| wi::to_widest (tok->value) > UCHAR_MAX)
+-	      break;
+-	    c_token *tok2 = c_parser_peek_nth_token (parser, 3);
+-	    if (tok2->type != CPP_COMMA && tok2->type != CPP_CLOSE_BRACE)
+-	      break;
+-	    buf2[i + off] = (char) tree_to_uhwi (tok->value);
+-	    /* If orig_len is INT_MAX, this can be flexible array member and
+-	       in that case we need to ensure another element which
+-	       for CPP_EMBED is normally guaranteed after it.  Include
+-	       that byte in the RAW_DATA_OWNER though, so it can be optimized
+-	       later.  */
+-	    if (tok2->type == CPP_CLOSE_BRACE && orig_len == INT_MAX)
+-	      {
+-		last = 1;
+-		break;
+-	      }
+-	    last_loc = tok->location;
+-	    c_parser_consume_token (parser);
+-	    c_parser_consume_token (parser);
+-	  }
+-	val = make_node (RAW_DATA_CST);
+-	TREE_TYPE (val) = integer_type_node;
+-	RAW_DATA_LENGTH (val) = i;
+-	tree owner = build_string (i + off + last, buf2);
+-	XDELETEVEC (buf2);
+-	TREE_TYPE (owner) = build_array_type_nelts (unsigned_char_type_node,
+-						    i + off + last);
+-	RAW_DATA_OWNER (val) = owner;
+-	RAW_DATA_POINTER (val) = TREE_STRING_POINTER (owner) + off;
+-	init.value = val;
+-	set_c_expr_source_range (&init, loc, last_loc);
+-	init.original_code = RAW_DATA_CST;
+-	init.original_type = integer_type_node;
+-	init.m_decimal = 0;
+-	process_init_element (loc, init, false, braced_init_obstack);
+-      }
+ }
+ 
+ /* Parse a compound statement (possibly a function body) (C90 6.6.2,
+diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
+index bfdcb78bbcc1..e23d8e59ac4b 100644
+--- a/gcc/c/c-tree.h
++++ b/gcc/c/c-tree.h
+@@ -832,7 +832,6 @@ extern struct c_expr pop_init_level (location_t, int, struct obstack *,
+ 				     location_t);
+ extern void set_init_index (location_t, tree, tree, struct obstack *);
+ extern void set_init_label (location_t, tree, location_t, struct obstack *);
+-unsigned c_maybe_optimize_large_byte_initializer (void);
+ extern void process_init_element (location_t, struct c_expr, bool,
+ 				  struct obstack *);
+ extern tree build_compound_literal (location_t, tree, tree, bool,
+diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
+index 108ea5ca3e8c..36d0b23a3d72 100644
+--- a/gcc/c/c-typeck.cc
++++ b/gcc/c/c-typeck.cc
+@@ -11347,42 +11347,6 @@ maybe_split_raw_data (tree value, tree *raw_data)
+   return value;
+ }
+ 
+-/* Return non-zero if c_parser_initval should attempt to optimize
+-   large initializers into RAW_DATA_CST.  In that case return how
+-   many elements to optimize at most.  */
+-
+-unsigned
+-c_maybe_optimize_large_byte_initializer (void)
+-{
+-  if (!constructor_type
+-      || TREE_CODE (constructor_type) != ARRAY_TYPE
+-      || constructor_stack->implicit)
+-    return 0;
+-  tree elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type));
+-  if (TREE_CODE (elttype) != INTEGER_TYPE
+-      && TREE_CODE (elttype) != BITINT_TYPE)
+-    return 0;
+-  if (TYPE_PRECISION (elttype) != CHAR_BIT
+-      || constructor_stack->replacement_value.value
+-      || (COMPLETE_TYPE_P (constructor_type)
+-	  && !poly_int_tree_p (TYPE_SIZE (constructor_type)))
+-      || constructor_range_stack)
+-    return 0;
+-  if (constructor_max_index == NULL_TREE)
+-    return INT_MAX;
+-  if (tree_int_cst_le (constructor_max_index, constructor_index)
+-      || integer_all_onesp (constructor_max_index))
+-    return 0;
+-  widest_int w = wi::to_widest (constructor_max_index);
+-  w -= wi::to_widest (constructor_index);
+-  w += 1;
+-  if (w < 64)
+-    return 0;
+-  if (w > INT_MAX)
+-    return INT_MAX;
+-  return w.to_uhwi ();
+-}
+-
+ /* Add one non-braced element to the current constructor level.
+    This adjusts the current position within the constructor's type.
+    This may also start or terminate implicit levels
+-- 
+2.47.0
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-18 14:05 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-18 14:05 UTC (permalink / raw
  To: gentoo-commits

commit:     a36914b3932f5ae93d9f18d445be959cd61f1dff
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 18 14:05:27 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 18 14:05:27 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=a36914b3

15.0.0: drop 72_all_PR117192-andn.patch

Merged upstream.

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

 15.0.0/gentoo/72_all_PR117192-andn.patch | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR117192-andn.patch b/15.0.0/gentoo/72_all_PR117192-andn.patch
deleted file mode 100644
index f7706c1..0000000
--- a/15.0.0/gentoo/72_all_PR117192-andn.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-https://gcc.gnu.org/PR17192
-https://gcc.gnu.org/bugzilla/attachment.cgi?id=59373
-
-diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
-index ef4ed8b501a..506f4cab6a8 100644
---- a/gcc/config/i386/mmx.md
-+++ b/gcc/config/i386/mmx.md
-@@ -4470,9 +4470,9 @@ (define_split
- (define_expand "andn<mode>3"
-   [(set (match_operand:MMXMODEI 0 "register_operand")
-         (and:MMXMODEI
--          (not:MMXMODEI (match_operand:MMXMODEI 1 "register_operand"))
--          (match_operand:MMXMODEI 2 "register_operand")))]
--  "TARGET_SSE2")
-+          (not:MMXMODEI (match_operand:MMXMODEI 2 "register_operand"))
-+          (match_operand:MMXMODEI 1 "register_operand")))]
-+  "TARGET_MMX_WITH_SSE")
- 
- (define_insn "mmx_andnot<mode>3"
-   [(set (match_operand:MMXMODEI 0 "register_operand" "=y,x,x,v")


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-20 22:42 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-20 22:42 UTC (permalink / raw
  To: gentoo-commits

commit:     cc3680147a9d8db04f71bb6d4c30a5985e9deefe
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 20 22:42:13 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 20 22:42:13 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=cc368014

15.0.0: cut patchset 17

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

 15.0.0/gentoo/README.history | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 073283d..52ceb20 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,8 @@
+17	20 October 2024
+
+	+ 73_all_PR117190-Revert-c-Fix-up-speed-up-compilation-of-large-char-a.patch
+	+ 74_all_PR117190-Revert-c-Speed-up-compilation-of-large-char-array-in.patch
+
 16	13 October 2024
 
 	+ 70_all_PR116506-coro.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-21 11:45 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-21 11:45 UTC (permalink / raw
  To: gentoo-commits

commit:     059d75a5509ca0a831a4aebb4f944fb6dc09a205
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 21 11:44:52 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct 21 11:44:52 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=059d75a5

15.0.0: add 75_all_PR117220-uninitialized-clang.patch

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

 .../75_all_PR117220-uninitialized-clang.patch      | 65 ++++++++++++++++++++++
 15.0.0/gentoo/README.history                       |  4 ++
 2 files changed, 69 insertions(+)

diff --git a/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch b/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch
new file mode 100644
index 0000000..f923cbd
--- /dev/null
+++ b/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch
@@ -0,0 +1,65 @@
+From 8974ee300419c422f8d771343263c05af0a53a2a Mon Sep 17 00:00:00 2001
+Message-ID: <8974ee300419c422f8d771343263c05af0a53a2a.1729510984.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Mon, 21 Oct 2024 12:42:16 +0100
+Subject: [PATCH] libstdc++: fix stl_iterator.h for Clang
+
+libstdc++-v3/ChangeLog:
+	PR libstdc++/117220
+
+	* include/bits/stl_iterator.h: Fix attribute order for Clang.
+--- a/libstdc++-v3/include/bits/stl_iterator.h
++++ b/libstdc++-v3/include/bits/stl_iterator.h
+@@ -1077,13 +1077,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
+       // Forward iterator requirements
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       reference
+       operator*() const _GLIBCXX_NOEXCEPT
+       { return *_M_current; }
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       pointer
+       operator->() const _GLIBCXX_NOEXCEPT
+@@ -1123,7 +1123,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
+       // Random access iterator requirements
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       reference
+       operator[](difference_type __n) const _GLIBCXX_NOEXCEPT
+@@ -1135,7 +1135,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+       operator+=(difference_type __n) _GLIBCXX_NOEXCEPT
+       { _M_current += __n; return *this; }
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       __normal_iterator
+       operator+(difference_type __n) const _GLIBCXX_NOEXCEPT
+@@ -1147,13 +1147,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+       operator-=(difference_type __n) _GLIBCXX_NOEXCEPT
+       { _M_current -= __n; return *this; }
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       __normal_iterator
+       operator-(difference_type __n) const _GLIBCXX_NOEXCEPT
+       { return __normal_iterator(_M_current - __n); }
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       const _Iterator&
+       base() const _GLIBCXX_NOEXCEPT
+-- 
+2.47.0
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 52ceb20..7cc59ef 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+18	21 October 2024
+
+	+ 75_all_PR117220-uninitialized-clang.patch
+
 17	20 October 2024
 
 	+ 73_all_PR117190-Revert-c-Fix-up-speed-up-compilation-of-large-char-a.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-21 12:26 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-21 12:26 UTC (permalink / raw
  To: gentoo-commits

commit:     7aa175a83520bb175c4588301daaa9ab14117bc7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 21 12:26:03 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct 21 12:26:03 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7aa175a8

15.0.0: drop 75_all_PR117220-uninitialized-clang.patch

A variant is now merged upstream.

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

 .../75_all_PR117220-uninitialized-clang.patch      | 65 ----------------------
 1 file changed, 65 deletions(-)

diff --git a/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch b/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch
deleted file mode 100644
index f923cbd..0000000
--- a/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 8974ee300419c422f8d771343263c05af0a53a2a Mon Sep 17 00:00:00 2001
-Message-ID: <8974ee300419c422f8d771343263c05af0a53a2a.1729510984.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Mon, 21 Oct 2024 12:42:16 +0100
-Subject: [PATCH] libstdc++: fix stl_iterator.h for Clang
-
-libstdc++-v3/ChangeLog:
-	PR libstdc++/117220
-
-	* include/bits/stl_iterator.h: Fix attribute order for Clang.
---- a/libstdc++-v3/include/bits/stl_iterator.h
-+++ b/libstdc++-v3/include/bits/stl_iterator.h
-@@ -1077,13 +1077,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
- 
-       // Forward iterator requirements
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       reference
-       operator*() const _GLIBCXX_NOEXCEPT
-       { return *_M_current; }
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       pointer
-       operator->() const _GLIBCXX_NOEXCEPT
-@@ -1123,7 +1123,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
- 
-       // Random access iterator requirements
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       reference
-       operator[](difference_type __n) const _GLIBCXX_NOEXCEPT
-@@ -1135,7 +1135,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-       operator+=(difference_type __n) _GLIBCXX_NOEXCEPT
-       { _M_current += __n; return *this; }
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       __normal_iterator
-       operator+(difference_type __n) const _GLIBCXX_NOEXCEPT
-@@ -1147,13 +1147,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-       operator-=(difference_type __n) _GLIBCXX_NOEXCEPT
-       { _M_current -= __n; return *this; }
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       __normal_iterator
-       operator-(difference_type __n) const _GLIBCXX_NOEXCEPT
-       { return __normal_iterator(_M_current - __n); }
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       const _Iterator&
-       base() const _GLIBCXX_NOEXCEPT
--- 
-2.47.0
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-21 12:27 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-21 12:27 UTC (permalink / raw
  To: gentoo-commits

commit:     5ecbc3c9e907f74fa12599e0fa5672553cc8db15
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 21 12:27:28 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct 21 12:27:28 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5ecbc3c9

15.0.0: update 75_all_PR117220-uninitialized-clang.patch

... to roll one more patchset with it in, then we can drop it for live.

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

 .../75_all_PR117220-uninitialized-clang.patch      | 223 +++++++++++++++++++++
 15.0.0/gentoo/README.history                       |   4 +
 2 files changed, 227 insertions(+)

diff --git a/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch b/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch
new file mode 100644
index 0000000..a6acc09
--- /dev/null
+++ b/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch
@@ -0,0 +1,223 @@
+From cba80691251efccf44ab9aecb26558319605c9ea Mon Sep 17 00:00:00 2001
+Message-ID: <cba80691251efccf44ab9aecb26558319605c9ea.1729513605.git.sam@gentoo.org>
+From: Jonathan Wakely <jwakely@redhat.com>
+Date: Mon, 21 Oct 2024 12:09:36 +0100
+Subject: [PATCH] libstdc++: Fix order of [[...]] and __attribute__((...))
+ attrs [PR117220]
+
+GCC allows these in either order, but Clang doesn't like the C++11-style
+[[__nodiscard__]] coming after __attribute__((__always_inline__)).
+
+libstdc++-v3/ChangeLog:
+
+	PR libstdc++/117220
+	* include/bits/stl_iterator.h: Move _GLIBCXX_NODISCARD
+	annotations after __attribute__((__always_inline__)).
+--- a/libstdc++-v3/include/bits/stl_iterator.h
++++ b/libstdc++-v3/include/bits/stl_iterator.h
+@@ -1077,13 +1077,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
+       // Forward iterator requirements
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       reference
+       operator*() const _GLIBCXX_NOEXCEPT
+       { return *_M_current; }
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       pointer
+       operator->() const _GLIBCXX_NOEXCEPT
+@@ -1123,7 +1123,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
+       // Random access iterator requirements
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       reference
+       operator[](difference_type __n) const _GLIBCXX_NOEXCEPT
+@@ -1135,7 +1135,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+       operator+=(difference_type __n) _GLIBCXX_NOEXCEPT
+       { _M_current += __n; return *this; }
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       __normal_iterator
+       operator+(difference_type __n) const _GLIBCXX_NOEXCEPT
+@@ -1147,13 +1147,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+       operator-=(difference_type __n) _GLIBCXX_NOEXCEPT
+       { _M_current -= __n; return *this; }
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       __normal_iterator
+       operator-(difference_type __n) const _GLIBCXX_NOEXCEPT
+       { return __normal_iterator(_M_current - __n); }
+ 
+-      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+       _GLIBCXX_CONSTEXPR
+       const _Iterator&
+       base() const _GLIBCXX_NOEXCEPT
+@@ -1209,7 +1209,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ #else
+    // Forward iterator requirements
+   template<typename _IteratorL, typename _IteratorR, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline bool
+     operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ 	       const __normal_iterator<_IteratorR, _Container>& __rhs)
+@@ -1217,7 +1217,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() == __rhs.base(); }
+ 
+   template<typename _Iterator, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline bool
+     operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
+ 	       const __normal_iterator<_Iterator, _Container>& __rhs)
+@@ -1225,7 +1225,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() == __rhs.base(); }
+ 
+   template<typename _IteratorL, typename _IteratorR, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline bool
+     operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ 	       const __normal_iterator<_IteratorR, _Container>& __rhs)
+@@ -1233,7 +1233,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() != __rhs.base(); }
+ 
+   template<typename _Iterator, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline bool
+     operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,
+ 	       const __normal_iterator<_Iterator, _Container>& __rhs)
+@@ -1242,7 +1242,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
+   // Random access iterator requirements
+   template<typename _IteratorL, typename _IteratorR, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline bool
+     operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ 	      const __normal_iterator<_IteratorR, _Container>& __rhs)
+@@ -1250,7 +1250,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() < __rhs.base(); }
+ 
+   template<typename _Iterator, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR
+     inline bool
+     operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
+ 	      const __normal_iterator<_Iterator, _Container>& __rhs)
+@@ -1258,7 +1258,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() < __rhs.base(); }
+ 
+   template<typename _IteratorL, typename _IteratorR, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline bool
+     operator>(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ 	      const __normal_iterator<_IteratorR, _Container>& __rhs)
+@@ -1266,7 +1266,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() > __rhs.base(); }
+ 
+   template<typename _Iterator, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline bool
+     operator>(const __normal_iterator<_Iterator, _Container>& __lhs,
+ 	      const __normal_iterator<_Iterator, _Container>& __rhs)
+@@ -1274,7 +1274,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() > __rhs.base(); }
+ 
+   template<typename _IteratorL, typename _IteratorR, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline bool
+     operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ 	       const __normal_iterator<_IteratorR, _Container>& __rhs)
+@@ -1282,7 +1282,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() <= __rhs.base(); }
+ 
+   template<typename _Iterator, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline bool
+     operator<=(const __normal_iterator<_Iterator, _Container>& __lhs,
+ 	       const __normal_iterator<_Iterator, _Container>& __rhs)
+@@ -1290,7 +1290,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() <= __rhs.base(); }
+ 
+   template<typename _IteratorL, typename _IteratorR, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline bool
+     operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs,
+ 	       const __normal_iterator<_IteratorR, _Container>& __rhs)
+@@ -1298,7 +1298,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() >= __rhs.base(); }
+ 
+   template<typename _Iterator, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline bool
+     operator>=(const __normal_iterator<_Iterator, _Container>& __lhs,
+ 	       const __normal_iterator<_Iterator, _Container>& __rhs)
+@@ -1326,7 +1326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() - __rhs.base(); }
+ 
+   template<typename _Iterator, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline typename __normal_iterator<_Iterator, _Container>::difference_type
+     operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
+ 	      const __normal_iterator<_Iterator, _Container>& __rhs)
+@@ -1334,7 +1334,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     { return __lhs.base() - __rhs.base(); }
+ 
+   template<typename _Iterator, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
+     inline __normal_iterator<_Iterator, _Container>
+     operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
+ 	      __n, const __normal_iterator<_Iterator, _Container>& __i)
+@@ -2990,7 +2990,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+   // Unwrap a __normal_iterator to get the underlying iterator
+   // (usually a pointer). See uses in std::copy, std::fill, etc.
+   template<typename _Iterator, typename _Container>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+     _GLIBCXX20_CONSTEXPR
+     inline _Iterator
+     __niter_base(__gnu_cxx::__normal_iterator<_Iterator, _Container> __it)
+@@ -2999,7 +2999,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
+   // Fallback implementation used for iterators that can't be unwrapped.
+   template<typename _Iterator>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+     _GLIBCXX20_CONSTEXPR
+     inline _Iterator
+     __niter_base(_Iterator __it)
+@@ -3071,7 +3071,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ 
+   // No need to wrap, iterator already has the right type.
+   template<typename _Iterator>
+-    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
++    _GLIBCXX_NODISCARD __attribute__((__always_inline__))
+     _GLIBCXX20_CONSTEXPR
+     inline _Iterator
+     __niter_wrap(const _Iterator&, _Iterator __res)
+-- 
+2.47.0
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 7cc59ef..da76e70 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+19	21 October 2024
+
+	U 75_all_PR117220-uninitialized-clang.patch
+
 18	21 October 2024
 
 	+ 75_all_PR117220-uninitialized-clang.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-21 12:33 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-21 12:33 UTC (permalink / raw
  To: gentoo-commits

commit:     cea84be3fb8da9cc115f6fd5a4836c45356f6dc3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 21 12:32:54 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct 21 12:32:54 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=cea84be3

15.0.0: drop 75_all_PR117220-uninitialized-clang.patch

Merged upstream.

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

 .../75_all_PR117220-uninitialized-clang.patch      | 223 ---------------------
 1 file changed, 223 deletions(-)

diff --git a/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch b/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch
deleted file mode 100644
index a6acc09..0000000
--- a/15.0.0/gentoo/75_all_PR117220-uninitialized-clang.patch
+++ /dev/null
@@ -1,223 +0,0 @@
-From cba80691251efccf44ab9aecb26558319605c9ea Mon Sep 17 00:00:00 2001
-Message-ID: <cba80691251efccf44ab9aecb26558319605c9ea.1729513605.git.sam@gentoo.org>
-From: Jonathan Wakely <jwakely@redhat.com>
-Date: Mon, 21 Oct 2024 12:09:36 +0100
-Subject: [PATCH] libstdc++: Fix order of [[...]] and __attribute__((...))
- attrs [PR117220]
-
-GCC allows these in either order, but Clang doesn't like the C++11-style
-[[__nodiscard__]] coming after __attribute__((__always_inline__)).
-
-libstdc++-v3/ChangeLog:
-
-	PR libstdc++/117220
-	* include/bits/stl_iterator.h: Move _GLIBCXX_NODISCARD
-	annotations after __attribute__((__always_inline__)).
---- a/libstdc++-v3/include/bits/stl_iterator.h
-+++ b/libstdc++-v3/include/bits/stl_iterator.h
-@@ -1077,13 +1077,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
- 
-       // Forward iterator requirements
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       reference
-       operator*() const _GLIBCXX_NOEXCEPT
-       { return *_M_current; }
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       pointer
-       operator->() const _GLIBCXX_NOEXCEPT
-@@ -1123,7 +1123,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
- 
-       // Random access iterator requirements
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       reference
-       operator[](difference_type __n) const _GLIBCXX_NOEXCEPT
-@@ -1135,7 +1135,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-       operator+=(difference_type __n) _GLIBCXX_NOEXCEPT
-       { _M_current += __n; return *this; }
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       __normal_iterator
-       operator+(difference_type __n) const _GLIBCXX_NOEXCEPT
-@@ -1147,13 +1147,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-       operator-=(difference_type __n) _GLIBCXX_NOEXCEPT
-       { _M_current -= __n; return *this; }
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       __normal_iterator
-       operator-(difference_type __n) const _GLIBCXX_NOEXCEPT
-       { return __normal_iterator(_M_current - __n); }
- 
--      __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+      _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-       _GLIBCXX_CONSTEXPR
-       const _Iterator&
-       base() const _GLIBCXX_NOEXCEPT
-@@ -1209,7 +1209,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
- #else
-    // Forward iterator requirements
-   template<typename _IteratorL, typename _IteratorR, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline bool
-     operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
- 	       const __normal_iterator<_IteratorR, _Container>& __rhs)
-@@ -1217,7 +1217,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() == __rhs.base(); }
- 
-   template<typename _Iterator, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline bool
-     operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
- 	       const __normal_iterator<_Iterator, _Container>& __rhs)
-@@ -1225,7 +1225,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() == __rhs.base(); }
- 
-   template<typename _IteratorL, typename _IteratorR, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline bool
-     operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,
- 	       const __normal_iterator<_IteratorR, _Container>& __rhs)
-@@ -1233,7 +1233,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() != __rhs.base(); }
- 
-   template<typename _Iterator, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline bool
-     operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,
- 	       const __normal_iterator<_Iterator, _Container>& __rhs)
-@@ -1242,7 +1242,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
- 
-   // Random access iterator requirements
-   template<typename _IteratorL, typename _IteratorR, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline bool
-     operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
- 	      const __normal_iterator<_IteratorR, _Container>& __rhs)
-@@ -1250,7 +1250,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() < __rhs.base(); }
- 
-   template<typename _Iterator, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR
-     inline bool
-     operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
- 	      const __normal_iterator<_Iterator, _Container>& __rhs)
-@@ -1258,7 +1258,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() < __rhs.base(); }
- 
-   template<typename _IteratorL, typename _IteratorR, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline bool
-     operator>(const __normal_iterator<_IteratorL, _Container>& __lhs,
- 	      const __normal_iterator<_IteratorR, _Container>& __rhs)
-@@ -1266,7 +1266,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() > __rhs.base(); }
- 
-   template<typename _Iterator, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline bool
-     operator>(const __normal_iterator<_Iterator, _Container>& __lhs,
- 	      const __normal_iterator<_Iterator, _Container>& __rhs)
-@@ -1274,7 +1274,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() > __rhs.base(); }
- 
-   template<typename _IteratorL, typename _IteratorR, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline bool
-     operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs,
- 	       const __normal_iterator<_IteratorR, _Container>& __rhs)
-@@ -1282,7 +1282,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() <= __rhs.base(); }
- 
-   template<typename _Iterator, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline bool
-     operator<=(const __normal_iterator<_Iterator, _Container>& __lhs,
- 	       const __normal_iterator<_Iterator, _Container>& __rhs)
-@@ -1290,7 +1290,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() <= __rhs.base(); }
- 
-   template<typename _IteratorL, typename _IteratorR, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline bool
-     operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs,
- 	       const __normal_iterator<_IteratorR, _Container>& __rhs)
-@@ -1298,7 +1298,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() >= __rhs.base(); }
- 
-   template<typename _Iterator, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline bool
-     operator>=(const __normal_iterator<_Iterator, _Container>& __lhs,
- 	       const __normal_iterator<_Iterator, _Container>& __rhs)
-@@ -1326,7 +1326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() - __rhs.base(); }
- 
-   template<typename _Iterator, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline typename __normal_iterator<_Iterator, _Container>::difference_type
-     operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
- 	      const __normal_iterator<_Iterator, _Container>& __rhs)
-@@ -1334,7 +1334,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-     { return __lhs.base() - __rhs.base(); }
- 
-   template<typename _Iterator, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR
-     inline __normal_iterator<_Iterator, _Container>
-     operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
- 	      __n, const __normal_iterator<_Iterator, _Container>& __i)
-@@ -2990,7 +2990,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
-   // Unwrap a __normal_iterator to get the underlying iterator
-   // (usually a pointer). See uses in std::copy, std::fill, etc.
-   template<typename _Iterator, typename _Container>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-     _GLIBCXX20_CONSTEXPR
-     inline _Iterator
-     __niter_base(__gnu_cxx::__normal_iterator<_Iterator, _Container> __it)
-@@ -2999,7 +2999,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
- 
-   // Fallback implementation used for iterators that can't be unwrapped.
-   template<typename _Iterator>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-     _GLIBCXX20_CONSTEXPR
-     inline _Iterator
-     __niter_base(_Iterator __it)
-@@ -3071,7 +3071,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
- 
-   // No need to wrap, iterator already has the right type.
-   template<typename _Iterator>
--    __attribute__((__always_inline__)) _GLIBCXX_NODISCARD
-+    _GLIBCXX_NODISCARD __attribute__((__always_inline__))
-     _GLIBCXX20_CONSTEXPR
-     inline _Iterator
-     __niter_wrap(const _Iterator&, _Iterator __res)
--- 
-2.47.0
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-22 18:34 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-22 18:34 UTC (permalink / raw
  To: gentoo-commits

commit:     a243737dd99899c96fa69256022d1d94a1d91c92
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 22 18:33:44 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 22 18:33:44 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=a243737d

15.0.0: drop obsolete embed patches

It's fixed now so no need for reverts.

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

 ...x-up-speed-up-compilation-of-large-char-a.patch |  97 ----------
 ...eed-up-compilation-of-large-char-array-in.patch | 212 ---------------------
 15.0.0/gentoo/README.history                       |   5 +
 3 files changed, 5 insertions(+), 309 deletions(-)

diff --git a/15.0.0/gentoo/73_all_PR117190-Revert-c-Fix-up-speed-up-compilation-of-large-char-a.patch b/15.0.0/gentoo/73_all_PR117190-Revert-c-Fix-up-speed-up-compilation-of-large-char-a.patch
deleted file mode 100644
index 47f26cc..0000000
--- a/15.0.0/gentoo/73_all_PR117190-Revert-c-Fix-up-speed-up-compilation-of-large-char-a.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-From bfec21e6cf88b0b64bfcc30d2f5ae3b3370e36e3 Mon Sep 17 00:00:00 2001
-Message-ID: <bfec21e6cf88b0b64bfcc30d2f5ae3b3370e36e3.1729247640.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Fri, 18 Oct 2024 11:31:20 +0100
-Subject: [PATCH 1/2] Revert "c: Fix up speed up compilation of large char
- array initializers when not using #embed [PR117177]"
-
-This reverts commit 96ba5e5663d4390a7e69735ce3c9de657fc543fc.
-
-Keep the testcase.
-
-Bug: https://gcc.gnu.org/PR117190
----
- gcc/c/c-parser.cc | 35 ++++++++++-------------------------
- 1 file changed, 10 insertions(+), 25 deletions(-)
-
-diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
-index 090ab1cbc088..e4381044e5cb 100644
---- a/gcc/c/c-parser.cc
-+++ b/gcc/c/c-parser.cc
-@@ -6529,7 +6529,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	unsigned int i;
- 	gcc_checking_assert (len >= 64);
- 	location_t last_loc = UNKNOWN_LOCATION;
--	location_t prev_loc = UNKNOWN_LOCATION;
- 	for (i = 0; i < 64; ++i)
- 	  {
- 	    c_token *tok = c_parser_peek_nth_token_raw (parser, 1 + 2 * i);
-@@ -6545,7 +6544,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	    buf1[i] = (char) tree_to_uhwi (tok->value);
- 	    if (i == 0)
- 	      loc = tok->location;
--	    prev_loc = last_loc;
- 	    last_loc = tok->location;
- 	  }
- 	if (i < 64)
-@@ -6569,7 +6567,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	unsigned int max_len = 131072 - offsetof (struct tree_string, str) - 1;
- 	unsigned int orig_len = len;
- 	unsigned int off = 0, last = 0;
--	unsigned char lastc = 0;
- 	if (!wi::neg_p (wi::to_wide (val)) && wi::to_widest (val) <= UCHAR_MAX)
- 	  off = 1;
- 	len = MIN (len, max_len - off);
-@@ -6599,25 +6596,20 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	    if (tok2->type != CPP_COMMA && tok2->type != CPP_CLOSE_BRACE)
- 	      break;
- 	    buf2[i + off] = (char) tree_to_uhwi (tok->value);
--	    prev_loc = last_loc;
-+	    /* If orig_len is INT_MAX, this can be flexible array member and
-+	       in that case we need to ensure another element which
-+	       for CPP_EMBED is normally guaranteed after it.  Include
-+	       that byte in the RAW_DATA_OWNER though, so it can be optimized
-+	       later.  */
-+	    if (tok2->type == CPP_CLOSE_BRACE && orig_len == INT_MAX)
-+	      {
-+		last = 1;
-+		break;
-+	      }
- 	    last_loc = tok->location;
- 	    c_parser_consume_token (parser);
- 	    c_parser_consume_token (parser);
- 	  }
--	/* If orig_len is INT_MAX, this can be flexible array member and
--	   in that case we need to ensure another element which
--	   for CPP_EMBED is normally guaranteed after it.  Include
--	   that byte in the RAW_DATA_OWNER though, so it can be optimized
--	   later.  */
--	if (orig_len == INT_MAX
--	    && (!c_parser_next_token_is (parser, CPP_COMMA)
--		|| c_parser_peek_2nd_token (parser)->type != CPP_NUMBER))
--	  {
--	    --i;
--	    last = 1;
--	    std::swap (prev_loc, last_loc);
--	    lastc = (unsigned char) buf2[i + off];
--	  }
- 	val = make_node (RAW_DATA_CST);
- 	TREE_TYPE (val) = integer_type_node;
- 	RAW_DATA_LENGTH (val) = i;
-@@ -6633,13 +6625,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	init.original_type = integer_type_node;
- 	init.m_decimal = 0;
- 	process_init_element (loc, init, false, braced_init_obstack);
--	if (last)
--	  {
--	    init.value = build_int_cst (integer_type_node, lastc);
--	    init.original_code = INTEGER_CST;
--	    set_c_expr_source_range (&init, prev_loc, prev_loc);
--	    process_init_element (prev_loc, init, false, braced_init_obstack);
--	  }
-       }
- }
- 
--- 
-2.47.0
-

diff --git a/15.0.0/gentoo/74_all_PR117190-Revert-c-Speed-up-compilation-of-large-char-array-in.patch b/15.0.0/gentoo/74_all_PR117190-Revert-c-Speed-up-compilation-of-large-char-array-in.patch
deleted file mode 100644
index 889c961..0000000
--- a/15.0.0/gentoo/74_all_PR117190-Revert-c-Speed-up-compilation-of-large-char-array-in.patch
+++ /dev/null
@@ -1,212 +0,0 @@
-From ec2844301e40a017a32b4f11f499d6db7629c6bf Mon Sep 17 00:00:00 2001
-Message-ID: <ec2844301e40a017a32b4f11f499d6db7629c6bf.1729247640.git.sam@gentoo.org>
-In-Reply-To: <bfec21e6cf88b0b64bfcc30d2f5ae3b3370e36e3.1729247640.git.sam@gentoo.org>
-References: <bfec21e6cf88b0b64bfcc30d2f5ae3b3370e36e3.1729247640.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Fri, 18 Oct 2024 11:31:27 +0100
-Subject: [PATCH 2/2] Revert "c: Speed up compilation of large char array
- initializers when not using #embed"
-
-This reverts commit f9bac238840155e1539aa68daf1507ea63c9ed80.
-
-Keep the testcase.
-
-Bug: https://gcc.gnu.org/PR117190
----
- gcc/c/c-parser.cc | 118 ----------------------------------------------
- gcc/c/c-tree.h    |   1 -
- gcc/c/c-typeck.cc |  36 --------------
- 3 files changed, 155 deletions(-)
-
-diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
-index e4381044e5cb..9518459a0a57 100644
---- a/gcc/c/c-parser.cc
-+++ b/gcc/c/c-parser.cc
-@@ -6507,125 +6507,7 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 					    (init.value))))
- 	init = convert_lvalue_to_rvalue (loc, init, true, true, true);
-     }
--  tree val = init.value;
-   process_init_element (loc, init, false, braced_init_obstack);
--
--  /* Attempt to optimize large char array initializers into RAW_DATA_CST
--     to save compile time and memory even when not using #embed.  */
--  static unsigned vals_to_ignore;
--  if (vals_to_ignore)
--    /* If earlier call determined there is certain number of CPP_COMMA
--       CPP_NUMBER tokens with 0-255 int values, but not enough for
--       RAW_DATA_CST to be beneficial, don't try to check it again until
--       they are all parsed.  */
--    --vals_to_ignore;
--  else if (val
--	   && TREE_CODE (val) == INTEGER_CST
--	   && TREE_TYPE (val) == integer_type_node
--	   && c_parser_next_token_is (parser, CPP_COMMA))
--    if (unsigned int len = c_maybe_optimize_large_byte_initializer ())
--      {
--	char buf1[64];
--	unsigned int i;
--	gcc_checking_assert (len >= 64);
--	location_t last_loc = UNKNOWN_LOCATION;
--	for (i = 0; i < 64; ++i)
--	  {
--	    c_token *tok = c_parser_peek_nth_token_raw (parser, 1 + 2 * i);
--	    if (tok->type != CPP_COMMA)
--	      break;
--	    tok = c_parser_peek_nth_token_raw (parser, 2 + 2 * i);
--	    if (tok->type != CPP_NUMBER
--		|| TREE_CODE (tok->value) != INTEGER_CST
--		|| TREE_TYPE (tok->value) != integer_type_node
--		|| wi::neg_p (wi::to_wide (tok->value))
--		|| wi::to_widest (tok->value) > UCHAR_MAX)
--	      break;
--	    buf1[i] = (char) tree_to_uhwi (tok->value);
--	    if (i == 0)
--	      loc = tok->location;
--	    last_loc = tok->location;
--	  }
--	if (i < 64)
--	  {
--	    vals_to_ignore = i;
--	    return;
--	  }
--	c_token *tok = c_parser_peek_nth_token_raw (parser, 1 + 2 * i);
--	/* If 64 CPP_COMMA CPP_NUMBER pairs are followed by CPP_CLOSE_BRACE,
--	   punt if len is INT_MAX as that can mean this is a flexible array
--	   member and in that case we need one CPP_NUMBER afterwards
--	   (as guaranteed for CPP_EMBED).  */
--	if (tok->type == CPP_CLOSE_BRACE && len != INT_MAX)
--	  len = i;
--	else if (tok->type != CPP_COMMA)
--	  {
--	    vals_to_ignore = i;
--	    return;
--	  }
--	/* Ensure the STRING_CST fits into 128K.  */
--	unsigned int max_len = 131072 - offsetof (struct tree_string, str) - 1;
--	unsigned int orig_len = len;
--	unsigned int off = 0, last = 0;
--	if (!wi::neg_p (wi::to_wide (val)) && wi::to_widest (val) <= UCHAR_MAX)
--	  off = 1;
--	len = MIN (len, max_len - off);
--	char *buf2 = XNEWVEC (char, len + off);
--	if (off)
--	  buf2[0] = (char) tree_to_uhwi (val);
--	memcpy (buf2 + off, buf1, i);
--	for (unsigned int j = 0; j < i; ++j)
--	  {
--	    c_parser_peek_token (parser);
--	    c_parser_consume_token (parser);
--	    c_parser_peek_token (parser);
--	    c_parser_consume_token (parser);
--	  }
--	for (; i < len; ++i)
--	  {
--	    if (!c_parser_next_token_is (parser, CPP_COMMA))
--	      break;
--	    tok = c_parser_peek_2nd_token (parser);
--	    if (tok->type != CPP_NUMBER
--		|| TREE_CODE (tok->value) != INTEGER_CST
--		|| TREE_TYPE (tok->value) != integer_type_node
--		|| wi::neg_p (wi::to_wide (tok->value))
--		|| wi::to_widest (tok->value) > UCHAR_MAX)
--	      break;
--	    c_token *tok2 = c_parser_peek_nth_token (parser, 3);
--	    if (tok2->type != CPP_COMMA && tok2->type != CPP_CLOSE_BRACE)
--	      break;
--	    buf2[i + off] = (char) tree_to_uhwi (tok->value);
--	    /* If orig_len is INT_MAX, this can be flexible array member and
--	       in that case we need to ensure another element which
--	       for CPP_EMBED is normally guaranteed after it.  Include
--	       that byte in the RAW_DATA_OWNER though, so it can be optimized
--	       later.  */
--	    if (tok2->type == CPP_CLOSE_BRACE && orig_len == INT_MAX)
--	      {
--		last = 1;
--		break;
--	      }
--	    last_loc = tok->location;
--	    c_parser_consume_token (parser);
--	    c_parser_consume_token (parser);
--	  }
--	val = make_node (RAW_DATA_CST);
--	TREE_TYPE (val) = integer_type_node;
--	RAW_DATA_LENGTH (val) = i;
--	tree owner = build_string (i + off + last, buf2);
--	XDELETEVEC (buf2);
--	TREE_TYPE (owner) = build_array_type_nelts (unsigned_char_type_node,
--						    i + off + last);
--	RAW_DATA_OWNER (val) = owner;
--	RAW_DATA_POINTER (val) = TREE_STRING_POINTER (owner) + off;
--	init.value = val;
--	set_c_expr_source_range (&init, loc, last_loc);
--	init.original_code = RAW_DATA_CST;
--	init.original_type = integer_type_node;
--	init.m_decimal = 0;
--	process_init_element (loc, init, false, braced_init_obstack);
--      }
- }
- 
- /* Parse a compound statement (possibly a function body) (C90 6.6.2,
-diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
-index bfdcb78bbcc1..e23d8e59ac4b 100644
---- a/gcc/c/c-tree.h
-+++ b/gcc/c/c-tree.h
-@@ -832,7 +832,6 @@ extern struct c_expr pop_init_level (location_t, int, struct obstack *,
- 				     location_t);
- extern void set_init_index (location_t, tree, tree, struct obstack *);
- extern void set_init_label (location_t, tree, location_t, struct obstack *);
--unsigned c_maybe_optimize_large_byte_initializer (void);
- extern void process_init_element (location_t, struct c_expr, bool,
- 				  struct obstack *);
- extern tree build_compound_literal (location_t, tree, tree, bool,
-diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
-index 108ea5ca3e8c..36d0b23a3d72 100644
---- a/gcc/c/c-typeck.cc
-+++ b/gcc/c/c-typeck.cc
-@@ -11347,42 +11347,6 @@ maybe_split_raw_data (tree value, tree *raw_data)
-   return value;
- }
- 
--/* Return non-zero if c_parser_initval should attempt to optimize
--   large initializers into RAW_DATA_CST.  In that case return how
--   many elements to optimize at most.  */
--
--unsigned
--c_maybe_optimize_large_byte_initializer (void)
--{
--  if (!constructor_type
--      || TREE_CODE (constructor_type) != ARRAY_TYPE
--      || constructor_stack->implicit)
--    return 0;
--  tree elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type));
--  if (TREE_CODE (elttype) != INTEGER_TYPE
--      && TREE_CODE (elttype) != BITINT_TYPE)
--    return 0;
--  if (TYPE_PRECISION (elttype) != CHAR_BIT
--      || constructor_stack->replacement_value.value
--      || (COMPLETE_TYPE_P (constructor_type)
--	  && !poly_int_tree_p (TYPE_SIZE (constructor_type)))
--      || constructor_range_stack)
--    return 0;
--  if (constructor_max_index == NULL_TREE)
--    return INT_MAX;
--  if (tree_int_cst_le (constructor_max_index, constructor_index)
--      || integer_all_onesp (constructor_max_index))
--    return 0;
--  widest_int w = wi::to_widest (constructor_max_index);
--  w -= wi::to_widest (constructor_index);
--  w += 1;
--  if (w < 64)
--    return 0;
--  if (w > INT_MAX)
--    return INT_MAX;
--  return w.to_uhwi ();
--}
--
- /* Add one non-braced element to the current constructor level.
-    This adjusts the current position within the constructor's type.
-    This may also start or terminate implicit levels
--- 
-2.47.0
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index da76e70..bc7c1e6 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,8 @@
+20	????
+
+	- 73_all_PR117190-Revert-c-Fix-up-speed-up-compilation-of-large-char-a.patch
+	- 74_all_PR117190-Revert-c-Speed-up-compilation-of-large-char-array-in.patch
+
 19	21 October 2024
 
 	U 75_all_PR117220-uninitialized-clang.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-22 19:09 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-22 19:09 UTC (permalink / raw
  To: gentoo-commits

commit:     52de78302a3c40e11a16185917bf8bb4bccfd199
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 22 19:09:05 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 22 19:09:05 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=52de7830

15.0.0: add 72_all_PR117190.patch

This patch isn't yet merged but should be soon.

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

 15.0.0/gentoo/72_all_PR117190.patch | 179 ++++++++++++++++++++++++++++++++++++
 1 file changed, 179 insertions(+)

diff --git a/15.0.0/gentoo/72_all_PR117190.patch b/15.0.0/gentoo/72_all_PR117190.patch
new file mode 100644
index 0000000..497d788
--- /dev/null
+++ b/15.0.0/gentoo/72_all_PR117190.patch
@@ -0,0 +1,179 @@
+From 756a3f3aad7200052d9aee207717c9766dce8be1 Mon Sep 17 00:00:00 2001
+Message-ID: <756a3f3aad7200052d9aee207717c9766dce8be1.1729624110.git.sam@gentoo.org>
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Tue, 22 Oct 2024 20:03:35 +0200
+Subject: [PATCH] c: Better fix for speed up compilation of large char array
+ initializers when not using #embed [PR117190]
+
+On Wed, Oct 16, 2024 at 11:09:32PM +0200, Jakub Jelinek wrote:
+> Apparently my
+> c: Speed up compilation of large char array initializers when not using #embed
+> patch broke building glibc.
+>
+> The issue is that when using CPP_EMBED, we are guaranteed by the
+> preprocessor that there is CPP_NUMBER CPP_COMMA before it and
+> CPP_COMMA CPP_NUMBER after it (or CPP_COMMA CPP_EMBED), so RAW_DATA_CST
+> never ends up at the end of arrays of unknown length.
+> Now, the c_parser_initval optimization attempted to preserve that property
+> rather than changing everything that e.g. inferes array number of elements
+> from the initializer etc. to deal with RAW_DATA_CST at the end, but
+> it didn't take into account the possibility that there could be
+> CPP_COMMA followed by CPP_CLOSE_BRACE (where the CPP_COMMA is redundant).
+>
+> As we are peaking already at 4 tokens in that code, peeking more would
+> require using raw tokens and that seems to be expensive doing it for
+> every pair of tokens due to vec_free done when we are out of raw tokens.
+
+Sorry for rushing the previous patch too much, turns out I was wrong,
+given that the c_parser_peek_nth_token numbering is 1 based, we can peek
+also with c_parser_peek_nth_token (parser, 4) and the loop actually peeked
+just at 3 tokens, not 4.
+
+So, I think it is better to revert the previous patch (but keep the new
+test) and instead peek the 4th non-raw token, which is what the following
+patch does.
+
+Additionally, PR117190 shows one further spot which missed the peek of
+the token after CPP_COMMA, in case it is incomplete array with exactly 65
+elements with redundant comma after it, which this patch handles too.
+
+Bootstrapped/regtested on x86_64-linux, i686-linux, powerpc64le-linux
+and powerpc64-linux, ok for trunk?
+
+2024-10-22  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c/117190
+gcc/c/
+	* c-parser.cc (c_parser_initval): Revert 2024-10-17 changes.
+	Instead peek the 4th token and if it is not CPP_NUMBER,
+	handle it like 3rd token CPP_CLOSE_BRACE for orig_len == INT_MAX.
+	Also, check (2 + 2 * i)th raw token for the orig_len == INT_MAX
+	case and punt if it is not CPP_NUMBER.
+gcc/testsuite/
+	* c-c++-common/init-5.c: New test.
+---
+ gcc/c/c-parser.cc                   | 42 +++++++++++------------------
+ gcc/testsuite/c-c++-common/init-5.c | 19 +++++++++++++
+ 2 files changed, 35 insertions(+), 26 deletions(-)
+ create mode 100644 gcc/testsuite/c-c++-common/init-5.c
+
+diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
+index 090ab1cbc088..3f2d7ddc5c42 100644
+--- a/gcc/c/c-parser.cc
++++ b/gcc/c/c-parser.cc
+@@ -6529,7 +6529,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	unsigned int i;
+ 	gcc_checking_assert (len >= 64);
+ 	location_t last_loc = UNKNOWN_LOCATION;
+-	location_t prev_loc = UNKNOWN_LOCATION;
+ 	for (i = 0; i < 64; ++i)
+ 	  {
+ 	    c_token *tok = c_parser_peek_nth_token_raw (parser, 1 + 2 * i);
+@@ -6545,7 +6544,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	    buf1[i] = (char) tree_to_uhwi (tok->value);
+ 	    if (i == 0)
+ 	      loc = tok->location;
+-	    prev_loc = last_loc;
+ 	    last_loc = tok->location;
+ 	  }
+ 	if (i < 64)
+@@ -6560,7 +6558,9 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	   (as guaranteed for CPP_EMBED).  */
+ 	if (tok->type == CPP_CLOSE_BRACE && len != INT_MAX)
+ 	  len = i;
+-	else if (tok->type != CPP_COMMA)
++	else if (tok->type != CPP_COMMA
++		 || (c_parser_peek_nth_token_raw (parser, 2 + 2 * i)->type
++		     != CPP_NUMBER))
+ 	  {
+ 	    vals_to_ignore = i;
+ 	    return;
+@@ -6569,7 +6569,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	unsigned int max_len = 131072 - offsetof (struct tree_string, str) - 1;
+ 	unsigned int orig_len = len;
+ 	unsigned int off = 0, last = 0;
+-	unsigned char lastc = 0;
+ 	if (!wi::neg_p (wi::to_wide (val)) && wi::to_widest (val) <= UCHAR_MAX)
+ 	  off = 1;
+ 	len = MIN (len, max_len - off);
+@@ -6599,25 +6598,23 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	    if (tok2->type != CPP_COMMA && tok2->type != CPP_CLOSE_BRACE)
+ 	      break;
+ 	    buf2[i + off] = (char) tree_to_uhwi (tok->value);
+-	    prev_loc = last_loc;
++	    /* If orig_len is INT_MAX, this can be flexible array member and
++	       in that case we need to ensure another element which
++	       for CPP_EMBED is normally guaranteed after it.  Include
++	       that byte in the RAW_DATA_OWNER though, so it can be optimized
++	       later.  */
++	    if (orig_len == INT_MAX
++		&& (tok2->type == CPP_CLOSE_BRACE
++		    || (c_parser_peek_nth_token (parser, 4)->type
++			!= CPP_NUMBER)))
++	      {
++		last = 1;
++		break;
++	      }
+ 	    last_loc = tok->location;
+ 	    c_parser_consume_token (parser);
+ 	    c_parser_consume_token (parser);
+ 	  }
+-	/* If orig_len is INT_MAX, this can be flexible array member and
+-	   in that case we need to ensure another element which
+-	   for CPP_EMBED is normally guaranteed after it.  Include
+-	   that byte in the RAW_DATA_OWNER though, so it can be optimized
+-	   later.  */
+-	if (orig_len == INT_MAX
+-	    && (!c_parser_next_token_is (parser, CPP_COMMA)
+-		|| c_parser_peek_2nd_token (parser)->type != CPP_NUMBER))
+-	  {
+-	    --i;
+-	    last = 1;
+-	    std::swap (prev_loc, last_loc);
+-	    lastc = (unsigned char) buf2[i + off];
+-	  }
+ 	val = make_node (RAW_DATA_CST);
+ 	TREE_TYPE (val) = integer_type_node;
+ 	RAW_DATA_LENGTH (val) = i;
+@@ -6633,13 +6630,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
+ 	init.original_type = integer_type_node;
+ 	init.m_decimal = 0;
+ 	process_init_element (loc, init, false, braced_init_obstack);
+-	if (last)
+-	  {
+-	    init.value = build_int_cst (integer_type_node, lastc);
+-	    init.original_code = INTEGER_CST;
+-	    set_c_expr_source_range (&init, prev_loc, prev_loc);
+-	    process_init_element (prev_loc, init, false, braced_init_obstack);
+-	  }
+       }
+ }
+ 
+diff --git a/gcc/testsuite/c-c++-common/init-5.c b/gcc/testsuite/c-c++-common/init-5.c
+new file mode 100644
+index 000000000000..61b6cdb97e2f
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/init-5.c
+@@ -0,0 +1,19 @@
++/* PR c/117190 */
++/* { dg-do run } */
++/* { dg-options "-O2" } */
++
++struct S { char d[]; } v = {
++{ 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++  0, }
++};
++
++int
++main ()
++{
++  for (int i = 0; i < 65; ++i)
++    if (v.d[i] != (i == 0 ? 8 : 0))
++      __builtin_abort ();
++}
+-- 
+2.47.0
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-23 15:40 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-23 15:40 UTC (permalink / raw
  To: gentoo-commits

commit:     d4278761ff6c0c703c8cf4d105cac664e15a0df8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 23 15:39:45 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 23 15:39:45 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d4278761

15.0.0: drop 72_all_PR117190.patch

Merged upstream now.

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

 15.0.0/gentoo/72_all_PR117190.patch | 179 ------------------------------------
 1 file changed, 179 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR117190.patch b/15.0.0/gentoo/72_all_PR117190.patch
deleted file mode 100644
index 497d788..0000000
--- a/15.0.0/gentoo/72_all_PR117190.patch
+++ /dev/null
@@ -1,179 +0,0 @@
-From 756a3f3aad7200052d9aee207717c9766dce8be1 Mon Sep 17 00:00:00 2001
-Message-ID: <756a3f3aad7200052d9aee207717c9766dce8be1.1729624110.git.sam@gentoo.org>
-From: Jakub Jelinek <jakub@redhat.com>
-Date: Tue, 22 Oct 2024 20:03:35 +0200
-Subject: [PATCH] c: Better fix for speed up compilation of large char array
- initializers when not using #embed [PR117190]
-
-On Wed, Oct 16, 2024 at 11:09:32PM +0200, Jakub Jelinek wrote:
-> Apparently my
-> c: Speed up compilation of large char array initializers when not using #embed
-> patch broke building glibc.
->
-> The issue is that when using CPP_EMBED, we are guaranteed by the
-> preprocessor that there is CPP_NUMBER CPP_COMMA before it and
-> CPP_COMMA CPP_NUMBER after it (or CPP_COMMA CPP_EMBED), so RAW_DATA_CST
-> never ends up at the end of arrays of unknown length.
-> Now, the c_parser_initval optimization attempted to preserve that property
-> rather than changing everything that e.g. inferes array number of elements
-> from the initializer etc. to deal with RAW_DATA_CST at the end, but
-> it didn't take into account the possibility that there could be
-> CPP_COMMA followed by CPP_CLOSE_BRACE (where the CPP_COMMA is redundant).
->
-> As we are peaking already at 4 tokens in that code, peeking more would
-> require using raw tokens and that seems to be expensive doing it for
-> every pair of tokens due to vec_free done when we are out of raw tokens.
-
-Sorry for rushing the previous patch too much, turns out I was wrong,
-given that the c_parser_peek_nth_token numbering is 1 based, we can peek
-also with c_parser_peek_nth_token (parser, 4) and the loop actually peeked
-just at 3 tokens, not 4.
-
-So, I think it is better to revert the previous patch (but keep the new
-test) and instead peek the 4th non-raw token, which is what the following
-patch does.
-
-Additionally, PR117190 shows one further spot which missed the peek of
-the token after CPP_COMMA, in case it is incomplete array with exactly 65
-elements with redundant comma after it, which this patch handles too.
-
-Bootstrapped/regtested on x86_64-linux, i686-linux, powerpc64le-linux
-and powerpc64-linux, ok for trunk?
-
-2024-10-22  Jakub Jelinek  <jakub@redhat.com>
-
-	PR c/117190
-gcc/c/
-	* c-parser.cc (c_parser_initval): Revert 2024-10-17 changes.
-	Instead peek the 4th token and if it is not CPP_NUMBER,
-	handle it like 3rd token CPP_CLOSE_BRACE for orig_len == INT_MAX.
-	Also, check (2 + 2 * i)th raw token for the orig_len == INT_MAX
-	case and punt if it is not CPP_NUMBER.
-gcc/testsuite/
-	* c-c++-common/init-5.c: New test.
----
- gcc/c/c-parser.cc                   | 42 +++++++++++------------------
- gcc/testsuite/c-c++-common/init-5.c | 19 +++++++++++++
- 2 files changed, 35 insertions(+), 26 deletions(-)
- create mode 100644 gcc/testsuite/c-c++-common/init-5.c
-
-diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
-index 090ab1cbc088..3f2d7ddc5c42 100644
---- a/gcc/c/c-parser.cc
-+++ b/gcc/c/c-parser.cc
-@@ -6529,7 +6529,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	unsigned int i;
- 	gcc_checking_assert (len >= 64);
- 	location_t last_loc = UNKNOWN_LOCATION;
--	location_t prev_loc = UNKNOWN_LOCATION;
- 	for (i = 0; i < 64; ++i)
- 	  {
- 	    c_token *tok = c_parser_peek_nth_token_raw (parser, 1 + 2 * i);
-@@ -6545,7 +6544,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	    buf1[i] = (char) tree_to_uhwi (tok->value);
- 	    if (i == 0)
- 	      loc = tok->location;
--	    prev_loc = last_loc;
- 	    last_loc = tok->location;
- 	  }
- 	if (i < 64)
-@@ -6560,7 +6558,9 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	   (as guaranteed for CPP_EMBED).  */
- 	if (tok->type == CPP_CLOSE_BRACE && len != INT_MAX)
- 	  len = i;
--	else if (tok->type != CPP_COMMA)
-+	else if (tok->type != CPP_COMMA
-+		 || (c_parser_peek_nth_token_raw (parser, 2 + 2 * i)->type
-+		     != CPP_NUMBER))
- 	  {
- 	    vals_to_ignore = i;
- 	    return;
-@@ -6569,7 +6569,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	unsigned int max_len = 131072 - offsetof (struct tree_string, str) - 1;
- 	unsigned int orig_len = len;
- 	unsigned int off = 0, last = 0;
--	unsigned char lastc = 0;
- 	if (!wi::neg_p (wi::to_wide (val)) && wi::to_widest (val) <= UCHAR_MAX)
- 	  off = 1;
- 	len = MIN (len, max_len - off);
-@@ -6599,25 +6598,23 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	    if (tok2->type != CPP_COMMA && tok2->type != CPP_CLOSE_BRACE)
- 	      break;
- 	    buf2[i + off] = (char) tree_to_uhwi (tok->value);
--	    prev_loc = last_loc;
-+	    /* If orig_len is INT_MAX, this can be flexible array member and
-+	       in that case we need to ensure another element which
-+	       for CPP_EMBED is normally guaranteed after it.  Include
-+	       that byte in the RAW_DATA_OWNER though, so it can be optimized
-+	       later.  */
-+	    if (orig_len == INT_MAX
-+		&& (tok2->type == CPP_CLOSE_BRACE
-+		    || (c_parser_peek_nth_token (parser, 4)->type
-+			!= CPP_NUMBER)))
-+	      {
-+		last = 1;
-+		break;
-+	      }
- 	    last_loc = tok->location;
- 	    c_parser_consume_token (parser);
- 	    c_parser_consume_token (parser);
- 	  }
--	/* If orig_len is INT_MAX, this can be flexible array member and
--	   in that case we need to ensure another element which
--	   for CPP_EMBED is normally guaranteed after it.  Include
--	   that byte in the RAW_DATA_OWNER though, so it can be optimized
--	   later.  */
--	if (orig_len == INT_MAX
--	    && (!c_parser_next_token_is (parser, CPP_COMMA)
--		|| c_parser_peek_2nd_token (parser)->type != CPP_NUMBER))
--	  {
--	    --i;
--	    last = 1;
--	    std::swap (prev_loc, last_loc);
--	    lastc = (unsigned char) buf2[i + off];
--	  }
- 	val = make_node (RAW_DATA_CST);
- 	TREE_TYPE (val) = integer_type_node;
- 	RAW_DATA_LENGTH (val) = i;
-@@ -6633,13 +6630,6 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
- 	init.original_type = integer_type_node;
- 	init.m_decimal = 0;
- 	process_init_element (loc, init, false, braced_init_obstack);
--	if (last)
--	  {
--	    init.value = build_int_cst (integer_type_node, lastc);
--	    init.original_code = INTEGER_CST;
--	    set_c_expr_source_range (&init, prev_loc, prev_loc);
--	    process_init_element (prev_loc, init, false, braced_init_obstack);
--	  }
-       }
- }
- 
-diff --git a/gcc/testsuite/c-c++-common/init-5.c b/gcc/testsuite/c-c++-common/init-5.c
-new file mode 100644
-index 000000000000..61b6cdb97e2f
---- /dev/null
-+++ b/gcc/testsuite/c-c++-common/init-5.c
-@@ -0,0 +1,19 @@
-+/* PR c/117190 */
-+/* { dg-do run } */
-+/* { dg-options "-O2" } */
-+
-+struct S { char d[]; } v = {
-+{ 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-+  0, }
-+};
-+
-+int
-+main ()
-+{
-+  for (int i = 0; i < 65; ++i)
-+    if (v.d[i] != (i == 0 ? 8 : 0))
-+      __builtin_abort ();
-+}
--- 
-2.47.0
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-28  8:09 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-28  8:09 UTC (permalink / raw
  To: gentoo-commits

commit:     a7fcb7ce0f8bf2b60e3988d30acb999eb4eb03d3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 28 08:09:04 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct 28 08:09:04 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=a7fcb7ce

15.0.0: cut patchset 20

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index bc7c1e6..92e1e14 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-20	????
+20	28 October 2024
 
 	- 73_all_PR117190-Revert-c-Fix-up-speed-up-compilation-of-large-char-a.patch
 	- 74_all_PR117190-Revert-c-Speed-up-compilation-of-large-char-array-in.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-28 21:32 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-28 21:32 UTC (permalink / raw
  To: gentoo-commits

commit:     a0691e3578dcab1c745e963bb4f9ffe2a3889cf3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 28 21:32:18 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct 28 21:32:18 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=a0691e35

15.0.0: add 72_all_PR117313-linux.patch

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

 15.0.0/gentoo/72_all_PR117313-linux.patch | 104 ++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/15.0.0/gentoo/72_all_PR117313-linux.patch b/15.0.0/gentoo/72_all_PR117313-linux.patch
new file mode 100644
index 0000000..c8cb2e8
--- /dev/null
+++ b/15.0.0/gentoo/72_all_PR117313-linux.patch
@@ -0,0 +1,104 @@
+2024-10-28  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c/117313
+gcc/c-family/
+	* c-common.cc (complete_array_type): For RAW_DATA_CST elements
+	advance curindex by RAW_DATA_LENGTH or one less than that if
+	ce->index is non-NULL.  Handle even the first element if
+	it is RAW_DATA_CST.  Formatting fix.
+gcc/testsuite/
+	* c-c++-common/init-6.c: New test.
+
+--- a/gcc/c-family/c-common.cc	2024-10-27 16:39:55.090871381 +0100
++++ b/gcc/c-family/c-common.cc	2024-10-28 12:30:01.215814079 +0100
+@@ -7044,7 +7044,8 @@ complete_array_type (tree *ptype, tree i
+ 	{
+ 	  int eltsize
+ 	    = int_size_in_bytes (TREE_TYPE (TREE_TYPE (initial_value)));
+-	  maxindex = size_int (TREE_STRING_LENGTH (initial_value)/eltsize - 1);
++	  maxindex = size_int (TREE_STRING_LENGTH (initial_value) / eltsize
++			       - 1);
+ 	}
+       else if (TREE_CODE (initial_value) == CONSTRUCTOR)
+ 	{
+@@ -7059,23 +7060,25 @@ complete_array_type (tree *ptype, tree i
+ 	  else
+ 	    {
+ 	      tree curindex;
+-	      unsigned HOST_WIDE_INT cnt;
++	      unsigned HOST_WIDE_INT cnt = 1;
+ 	      constructor_elt *ce;
+ 	      bool fold_p = false;
+ 
+ 	      if ((*v)[0].index)
+ 		maxindex = (*v)[0].index, fold_p = true;
++	      if (TREE_CODE ((*v)[0].value) == RAW_DATA_CST)
++		cnt = 0;
+ 
+ 	      curindex = maxindex;
+ 
+-	      for (cnt = 1; vec_safe_iterate (v, cnt, &ce); cnt++)
++	      for (; vec_safe_iterate (v, cnt, &ce); cnt++)
+ 		{
+ 		  bool curfold_p = false;
+ 		  if (ce->index)
+ 		    curindex = ce->index, curfold_p = true;
+-		  else
++		  if (!ce->index || TREE_CODE (ce->value) == RAW_DATA_CST)
+ 		    {
+-		      if (fold_p)
++		      if (fold_p || curfold_p)
+ 			{
+ 			  /* Since we treat size types now as ordinary
+ 			     unsigned types, we need an explicit overflow
+@@ -7083,9 +7086,16 @@ complete_array_type (tree *ptype, tree i
+ 			  tree orig = curindex;
+ 		          curindex = fold_convert (sizetype, curindex);
+ 			  overflow_p |= tree_int_cst_lt (curindex, orig);
++			  curfold_p = false;
+ 			}
+-		      curindex = size_binop (PLUS_EXPR, curindex,
+-					     size_one_node);
++		      if (TREE_CODE (ce->value) == RAW_DATA_CST)
++			curindex
++			  = size_binop (PLUS_EXPR, curindex,
++					size_int (RAW_DATA_LENGTH (ce->value)
++						  - (ce->index ? 1 : 0)));
++		      else
++			curindex = size_binop (PLUS_EXPR, curindex,
++					       size_one_node);
+ 		    }
+ 		  if (tree_int_cst_lt (maxindex, curindex))
+ 		    maxindex = curindex, fold_p = curfold_p;
+--- a/gcc/testsuite/c-c++-common/init-6.c	2024-10-28 12:35:59.526803017 +0100
++++ b/gcc/testsuite/c-c++-common/init-6.c	2024-10-28 12:35:50.394930729 +0100
+@@ -0,0 +1,29 @@
++/* PR c/117313 */
++/* { dg-do compile } */
++/* { dg-options "-O2" } */
++
++struct S { unsigned a; const unsigned char b[]; };
++struct S s = {
++  1,
++  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5,
++    0x81, 0xbd, 0x99, 0x81, 0x7e, 0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7,
++    0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x10,
++    0x38, 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
++    0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++    0x18, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c,
++  }
++};
++struct S t = {
++  2,
++  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5,
++    0x81, 0xbd, 0x99, 0x81, 0x7e, 0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7,
++    0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x10,
++    0x38, 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
++    0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++    0x18, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c,
++    0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x10,
++    0x38, 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
++    0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++    0x18, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c
++  }
++};


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-29 19:17 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-29 19:17 UTC (permalink / raw
  To: gentoo-commits

commit:     cf73522a8c586ea07421892617463fe80a3f05ae
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 29 19:17:04 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 29 19:17:04 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=cf73522a

15.0.0: drop 72_all_PR117313-linux.patch

Merged upstream.

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

 15.0.0/gentoo/72_all_PR117313-linux.patch | 104 ------------------------------
 1 file changed, 104 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR117313-linux.patch b/15.0.0/gentoo/72_all_PR117313-linux.patch
deleted file mode 100644
index c8cb2e8..0000000
--- a/15.0.0/gentoo/72_all_PR117313-linux.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-2024-10-28  Jakub Jelinek  <jakub@redhat.com>
-
-	PR c/117313
-gcc/c-family/
-	* c-common.cc (complete_array_type): For RAW_DATA_CST elements
-	advance curindex by RAW_DATA_LENGTH or one less than that if
-	ce->index is non-NULL.  Handle even the first element if
-	it is RAW_DATA_CST.  Formatting fix.
-gcc/testsuite/
-	* c-c++-common/init-6.c: New test.
-
---- a/gcc/c-family/c-common.cc	2024-10-27 16:39:55.090871381 +0100
-+++ b/gcc/c-family/c-common.cc	2024-10-28 12:30:01.215814079 +0100
-@@ -7044,7 +7044,8 @@ complete_array_type (tree *ptype, tree i
- 	{
- 	  int eltsize
- 	    = int_size_in_bytes (TREE_TYPE (TREE_TYPE (initial_value)));
--	  maxindex = size_int (TREE_STRING_LENGTH (initial_value)/eltsize - 1);
-+	  maxindex = size_int (TREE_STRING_LENGTH (initial_value) / eltsize
-+			       - 1);
- 	}
-       else if (TREE_CODE (initial_value) == CONSTRUCTOR)
- 	{
-@@ -7059,23 +7060,25 @@ complete_array_type (tree *ptype, tree i
- 	  else
- 	    {
- 	      tree curindex;
--	      unsigned HOST_WIDE_INT cnt;
-+	      unsigned HOST_WIDE_INT cnt = 1;
- 	      constructor_elt *ce;
- 	      bool fold_p = false;
- 
- 	      if ((*v)[0].index)
- 		maxindex = (*v)[0].index, fold_p = true;
-+	      if (TREE_CODE ((*v)[0].value) == RAW_DATA_CST)
-+		cnt = 0;
- 
- 	      curindex = maxindex;
- 
--	      for (cnt = 1; vec_safe_iterate (v, cnt, &ce); cnt++)
-+	      for (; vec_safe_iterate (v, cnt, &ce); cnt++)
- 		{
- 		  bool curfold_p = false;
- 		  if (ce->index)
- 		    curindex = ce->index, curfold_p = true;
--		  else
-+		  if (!ce->index || TREE_CODE (ce->value) == RAW_DATA_CST)
- 		    {
--		      if (fold_p)
-+		      if (fold_p || curfold_p)
- 			{
- 			  /* Since we treat size types now as ordinary
- 			     unsigned types, we need an explicit overflow
-@@ -7083,9 +7086,16 @@ complete_array_type (tree *ptype, tree i
- 			  tree orig = curindex;
- 		          curindex = fold_convert (sizetype, curindex);
- 			  overflow_p |= tree_int_cst_lt (curindex, orig);
-+			  curfold_p = false;
- 			}
--		      curindex = size_binop (PLUS_EXPR, curindex,
--					     size_one_node);
-+		      if (TREE_CODE (ce->value) == RAW_DATA_CST)
-+			curindex
-+			  = size_binop (PLUS_EXPR, curindex,
-+					size_int (RAW_DATA_LENGTH (ce->value)
-+						  - (ce->index ? 1 : 0)));
-+		      else
-+			curindex = size_binop (PLUS_EXPR, curindex,
-+					       size_one_node);
- 		    }
- 		  if (tree_int_cst_lt (maxindex, curindex))
- 		    maxindex = curindex, fold_p = curfold_p;
---- a/gcc/testsuite/c-c++-common/init-6.c	2024-10-28 12:35:59.526803017 +0100
-+++ b/gcc/testsuite/c-c++-common/init-6.c	2024-10-28 12:35:50.394930729 +0100
-@@ -0,0 +1,29 @@
-+/* PR c/117313 */
-+/* { dg-do compile } */
-+/* { dg-options "-O2" } */
-+
-+struct S { unsigned a; const unsigned char b[]; };
-+struct S s = {
-+  1,
-+  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5,
-+    0x81, 0xbd, 0x99, 0x81, 0x7e, 0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7,
-+    0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x10,
-+    0x38, 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
-+    0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+    0x18, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c,
-+  }
-+};
-+struct S t = {
-+  2,
-+  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5,
-+    0x81, 0xbd, 0x99, 0x81, 0x7e, 0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7,
-+    0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x10,
-+    0x38, 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
-+    0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+    0x18, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c,
-+    0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x10,
-+    0x38, 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
-+    0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+    0x18, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c
-+  }
-+};


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-10-30 16:03 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-10-30 16:03 UTC (permalink / raw
  To: gentoo-commits

commit:     e644776e934d664aae0b55d6ec4230327607934e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 30 16:03:30 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 30 16:03:30 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e644776e

15.0.0: revert bad pattern causing ICE

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

 15.0.0/gentoo/72_all_PR117363-revert.patch | 106 +++++++++++++++++++++++++++++
 1 file changed, 106 insertions(+)

diff --git a/15.0.0/gentoo/72_all_PR117363-revert.patch b/15.0.0/gentoo/72_all_PR117363-revert.patch
new file mode 100644
index 0000000..3e5be35
--- /dev/null
+++ b/15.0.0/gentoo/72_all_PR117363-revert.patch
@@ -0,0 +1,106 @@
+From a7df875788d7303639123771af1f4238e207f442 Mon Sep 17 00:00:00 2001
+Message-ID: <a7df875788d7303639123771af1f4238e207f442.1730304104.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Wed, 30 Oct 2024 15:59:01 +0000
+Subject: [PATCH] Revert "Match: Simplify (x != 0 ? x + ~0 : 0) to (x - x !=
+ 0)."
+
+This reverts commit 4af8db3eca12b2db3753ce4b098cbd0ae32b4796.
+
+Bug: https://gcc.gnu.org/PR117363
+---
+ gcc/match.pd                               | 10 ---------
+ gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c | 26 ----------------------
+ gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c | 26 ----------------------
+ 3 files changed, 62 deletions(-)
+ delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
+ delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
+
+diff --git a/gcc/match.pd b/gcc/match.pd
+index c851ac56e37c..809c717bc862 100644
+--- a/gcc/match.pd
++++ b/gcc/match.pd
+@@ -3391,16 +3391,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
+   }
+   (if (wi::eq_p (sum, wi::uhwi (0, precision)))))))
+ 
+-/* The boundary condition for case 10: IMM = 1:
+-   SAT_U_SUB = X >= IMM ? (X - IMM) : 0.
+-   simplify (X != 0 ? X + ~0 : 0) to (X - X != 0).  */
+-(simplify
+- (cond (ne@1 @0 integer_zerop)
+-       (nop_convert? (plus (nop_convert? @0) integer_all_onesp))
+-       integer_zerop)
+- (if (INTEGRAL_TYPE_P (type))
+-   (minus @0 (convert @1))))
+-
+ /* Signed saturation sub, case 1:
+    T minus = (T)((UT)X - (UT)Y);
+    SAT_S_SUB = (X ^ Y) & (X ^ minus) < 0 ? (-(T)(X < 0) ^ MAX) : minus;
+diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
+deleted file mode 100644
+index 962bf0954f62..000000000000
+--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
++++ /dev/null
+@@ -1,26 +0,0 @@
+-/* { dg-do compile } */
+-/* { dg-options "-O2 -fdump-tree-phiopt1" } */
+-
+-#include <stdint.h>
+-
+-uint8_t f1 (uint8_t x)
+-{
+-  return x >= (uint8_t)1 ? x - (uint8_t)1 : 0;
+-}
+-
+-uint16_t f2 (uint16_t x)
+-{
+-  return x >= (uint16_t)1 ? x - (uint16_t)1 : 0;
+-}
+-
+-uint32_t f3 (uint32_t x)
+-{
+-  return x >= (uint32_t)1 ? x - (uint32_t)1 : 0;
+-}
+-
+-uint64_t f4 (uint64_t x)
+-{
+-  return x >= (uint64_t)1 ? x - (uint64_t)1 : 0;
+-}
+-
+-/* { dg-final { scan-tree-dump-not "goto" "phiopt1" } } */
+diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
+deleted file mode 100644
+index 62a2ab631846..000000000000
+--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
++++ /dev/null
+@@ -1,26 +0,0 @@
+-/* { dg-do compile } */
+-/* { dg-options "-O2 -fdump-tree-phiopt1" } */
+-
+-#include <stdint.h>
+-
+-int8_t f1 (int8_t x)
+-{
+-  return x != 0 ? x - (int8_t)1 : 0;
+-}
+-
+-int16_t f2 (int16_t x)
+-{
+-  return x != 0 ? x - (int16_t)1 : 0;
+-}
+-
+-int32_t f3 (int32_t x)
+-{
+-  return x != 0 ? x - (int32_t)1 : 0;
+-}
+-
+-int64_t f4 (int64_t x)
+-{
+-  return x != 0 ? x - (int64_t)1 : 0;
+-}
+-
+-/* { dg-final { scan-tree-dump-not "goto" "phiopt1" } } */
+-- 
+2.47.0
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-01  8:17 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-01  8:17 UTC (permalink / raw
  To: gentoo-commits

commit:     e7cf23fa4728ef5ab8ab1e0bde2c1475d91cb7ed
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  1 08:17:03 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov  1 08:17:03 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e7cf23fa

15.0.0: add time64 patch

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

 15.0.0/gentoo/31_all_time64.patch | 39 +++++++++++++++++++++++++++++++++++++++
 15.0.0/gentoo/README.history      |  4 ++++
 2 files changed, 43 insertions(+)

diff --git a/15.0.0/gentoo/31_all_time64.patch b/15.0.0/gentoo/31_all_time64.patch
new file mode 100644
index 0000000..ac972b9
--- /dev/null
+++ b/15.0.0/gentoo/31_all_time64.patch
@@ -0,0 +1,39 @@
+From b2ee3846dfcea638e0fbf2d550234f1c7594fcdb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 1 Nov 2024 07:48:37 +0100
+Subject: [PATCH] Support forcing _TIME_BITS=64 for time64 profiles
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Support forcing _TIME_BITS=64 and _FILE_OFFSET_BITS=64
+via -D_GENTOO_TIME64_FORCE=1, for time64 profiles.
+
+Signed-off-by: Michał Górny <mgorny@gentoo.org>
+---
+ gcc/c-family/c-cppbuiltin.cc | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
+index 8bbfe84b2..962cbd414 100644
+--- a/gcc/c-family/c-cppbuiltin.cc
++++ b/gcc/c-family/c-cppbuiltin.cc
+@@ -1593,6 +1593,15 @@ c_cpp_builtins (cpp_reader *pfile)
+     builtin_define_with_int_value ("_FORTIFY_SOURCE", GENTOO_FORTIFY_SOURCE_LEVEL);
+ #endif
+ 
++#ifndef _GENTOO_TIME64_FORCE
++  #define _GENTOO_TIME64_FORCE 0
++#endif
++
++  if (_GENTOO_TIME64_FORCE) {
++    cpp_define (pfile, "_FILE_OFFSET_BITS=64");
++    cpp_define (pfile, "_TIME_BITS=64");
++  }
++
+   /* Misc.  */
+   if (flag_gnu89_inline)
+     cpp_define (pfile, "__GNUC_GNU_INLINE__");
+-- 
+2.47.0
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 92e1e14..39a708d 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+21	????
+
+	+ 31_all_time64.patch	
+
 20	28 October 2024
 
 	- 73_all_PR117190-Revert-c-Fix-up-speed-up-compilation-of-large-char-a.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-01  8:18 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-01  8:18 UTC (permalink / raw
  To: gentoo-commits

commit:     0460c30910a6114b6ad106633bad7a0a25b87535
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  1 08:18:28 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov  1 08:18:28 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=0460c309

15.00.: cut patchset 21

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 39a708d..2d6aaf8 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-21	????
+21	1 November 2024
 
 	+ 31_all_time64.patch	
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-01  8:24 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-01  8:24 UTC (permalink / raw
  To: gentoo-commits

commit:     5c6f5f3e37e314c90dc54d7e04483378df7a558e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  1 08:23:59 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov  1 08:24:06 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5c6f5f3e

Revert "15.0.0: respin patchset 2 to drop 72 revert patch"

This reverts commit 1da292bbeff6151ecb983ee5552d6ab8305bb4e7.

Still needed for live. Already spun 21 so we can onw put this back.

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

 15.0.0/gentoo/72_all_PR117363-revert.patch | 106 +++++++++++++++++++++++++++++
 1 file changed, 106 insertions(+)

diff --git a/15.0.0/gentoo/72_all_PR117363-revert.patch b/15.0.0/gentoo/72_all_PR117363-revert.patch
new file mode 100644
index 0000000..3e5be35
--- /dev/null
+++ b/15.0.0/gentoo/72_all_PR117363-revert.patch
@@ -0,0 +1,106 @@
+From a7df875788d7303639123771af1f4238e207f442 Mon Sep 17 00:00:00 2001
+Message-ID: <a7df875788d7303639123771af1f4238e207f442.1730304104.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Wed, 30 Oct 2024 15:59:01 +0000
+Subject: [PATCH] Revert "Match: Simplify (x != 0 ? x + ~0 : 0) to (x - x !=
+ 0)."
+
+This reverts commit 4af8db3eca12b2db3753ce4b098cbd0ae32b4796.
+
+Bug: https://gcc.gnu.org/PR117363
+---
+ gcc/match.pd                               | 10 ---------
+ gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c | 26 ----------------------
+ gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c | 26 ----------------------
+ 3 files changed, 62 deletions(-)
+ delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
+ delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
+
+diff --git a/gcc/match.pd b/gcc/match.pd
+index c851ac56e37c..809c717bc862 100644
+--- a/gcc/match.pd
++++ b/gcc/match.pd
+@@ -3391,16 +3391,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
+   }
+   (if (wi::eq_p (sum, wi::uhwi (0, precision)))))))
+ 
+-/* The boundary condition for case 10: IMM = 1:
+-   SAT_U_SUB = X >= IMM ? (X - IMM) : 0.
+-   simplify (X != 0 ? X + ~0 : 0) to (X - X != 0).  */
+-(simplify
+- (cond (ne@1 @0 integer_zerop)
+-       (nop_convert? (plus (nop_convert? @0) integer_all_onesp))
+-       integer_zerop)
+- (if (INTEGRAL_TYPE_P (type))
+-   (minus @0 (convert @1))))
+-
+ /* Signed saturation sub, case 1:
+    T minus = (T)((UT)X - (UT)Y);
+    SAT_S_SUB = (X ^ Y) & (X ^ minus) < 0 ? (-(T)(X < 0) ^ MAX) : minus;
+diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
+deleted file mode 100644
+index 962bf0954f62..000000000000
+--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
++++ /dev/null
+@@ -1,26 +0,0 @@
+-/* { dg-do compile } */
+-/* { dg-options "-O2 -fdump-tree-phiopt1" } */
+-
+-#include <stdint.h>
+-
+-uint8_t f1 (uint8_t x)
+-{
+-  return x >= (uint8_t)1 ? x - (uint8_t)1 : 0;
+-}
+-
+-uint16_t f2 (uint16_t x)
+-{
+-  return x >= (uint16_t)1 ? x - (uint16_t)1 : 0;
+-}
+-
+-uint32_t f3 (uint32_t x)
+-{
+-  return x >= (uint32_t)1 ? x - (uint32_t)1 : 0;
+-}
+-
+-uint64_t f4 (uint64_t x)
+-{
+-  return x >= (uint64_t)1 ? x - (uint64_t)1 : 0;
+-}
+-
+-/* { dg-final { scan-tree-dump-not "goto" "phiopt1" } } */
+diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
+deleted file mode 100644
+index 62a2ab631846..000000000000
+--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
++++ /dev/null
+@@ -1,26 +0,0 @@
+-/* { dg-do compile } */
+-/* { dg-options "-O2 -fdump-tree-phiopt1" } */
+-
+-#include <stdint.h>
+-
+-int8_t f1 (int8_t x)
+-{
+-  return x != 0 ? x - (int8_t)1 : 0;
+-}
+-
+-int16_t f2 (int16_t x)
+-{
+-  return x != 0 ? x - (int16_t)1 : 0;
+-}
+-
+-int32_t f3 (int32_t x)
+-{
+-  return x != 0 ? x - (int32_t)1 : 0;
+-}
+-
+-int64_t f4 (int64_t x)
+-{
+-  return x != 0 ? x - (int64_t)1 : 0;
+-}
+-
+-/* { dg-final { scan-tree-dump-not "goto" "phiopt1" } } */
+-- 
+2.47.0
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-01  8:24 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-01  8:24 UTC (permalink / raw
  To: gentoo-commits

commit:     1da292bbeff6151ecb983ee5552d6ab8305bb4e7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  1 08:21:55 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov  1 08:21:55 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=1da292bb

15.0.0: respin patchset 2 to drop 72 revert patch

That didn't land in the last snapshot, oops.

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

 15.0.0/gentoo/72_all_PR117363-revert.patch | 106 -----------------------------
 1 file changed, 106 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR117363-revert.patch b/15.0.0/gentoo/72_all_PR117363-revert.patch
deleted file mode 100644
index 3e5be35..0000000
--- a/15.0.0/gentoo/72_all_PR117363-revert.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-From a7df875788d7303639123771af1f4238e207f442 Mon Sep 17 00:00:00 2001
-Message-ID: <a7df875788d7303639123771af1f4238e207f442.1730304104.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Wed, 30 Oct 2024 15:59:01 +0000
-Subject: [PATCH] Revert "Match: Simplify (x != 0 ? x + ~0 : 0) to (x - x !=
- 0)."
-
-This reverts commit 4af8db3eca12b2db3753ce4b098cbd0ae32b4796.
-
-Bug: https://gcc.gnu.org/PR117363
----
- gcc/match.pd                               | 10 ---------
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c | 26 ----------------------
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c | 26 ----------------------
- 3 files changed, 62 deletions(-)
- delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
- delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
-
-diff --git a/gcc/match.pd b/gcc/match.pd
-index c851ac56e37c..809c717bc862 100644
---- a/gcc/match.pd
-+++ b/gcc/match.pd
-@@ -3391,16 +3391,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
-   }
-   (if (wi::eq_p (sum, wi::uhwi (0, precision)))))))
- 
--/* The boundary condition for case 10: IMM = 1:
--   SAT_U_SUB = X >= IMM ? (X - IMM) : 0.
--   simplify (X != 0 ? X + ~0 : 0) to (X - X != 0).  */
--(simplify
-- (cond (ne@1 @0 integer_zerop)
--       (nop_convert? (plus (nop_convert? @0) integer_all_onesp))
--       integer_zerop)
-- (if (INTEGRAL_TYPE_P (type))
--   (minus @0 (convert @1))))
--
- /* Signed saturation sub, case 1:
-    T minus = (T)((UT)X - (UT)Y);
-    SAT_S_SUB = (X ^ Y) & (X ^ minus) < 0 ? (-(T)(X < 0) ^ MAX) : minus;
-diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
-deleted file mode 100644
-index 962bf0954f62..000000000000
---- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
-+++ /dev/null
-@@ -1,26 +0,0 @@
--/* { dg-do compile } */
--/* { dg-options "-O2 -fdump-tree-phiopt1" } */
--
--#include <stdint.h>
--
--uint8_t f1 (uint8_t x)
--{
--  return x >= (uint8_t)1 ? x - (uint8_t)1 : 0;
--}
--
--uint16_t f2 (uint16_t x)
--{
--  return x >= (uint16_t)1 ? x - (uint16_t)1 : 0;
--}
--
--uint32_t f3 (uint32_t x)
--{
--  return x >= (uint32_t)1 ? x - (uint32_t)1 : 0;
--}
--
--uint64_t f4 (uint64_t x)
--{
--  return x >= (uint64_t)1 ? x - (uint64_t)1 : 0;
--}
--
--/* { dg-final { scan-tree-dump-not "goto" "phiopt1" } } */
-diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
-deleted file mode 100644
-index 62a2ab631846..000000000000
---- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
-+++ /dev/null
-@@ -1,26 +0,0 @@
--/* { dg-do compile } */
--/* { dg-options "-O2 -fdump-tree-phiopt1" } */
--
--#include <stdint.h>
--
--int8_t f1 (int8_t x)
--{
--  return x != 0 ? x - (int8_t)1 : 0;
--}
--
--int16_t f2 (int16_t x)
--{
--  return x != 0 ? x - (int16_t)1 : 0;
--}
--
--int32_t f3 (int32_t x)
--{
--  return x != 0 ? x - (int32_t)1 : 0;
--}
--
--int64_t f4 (int64_t x)
--{
--  return x != 0 ? x - (int64_t)1 : 0;
--}
--
--/* { dg-final { scan-tree-dump-not "goto" "phiopt1" } } */
--- 
-2.47.0
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-03 23:16 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-03 23:16 UTC (permalink / raw
  To: gentoo-commits

commit:     4857e834cefe40cf6c07def1aa9eac45d0021653
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  3 23:15:59 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov  3 23:16:09 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=4857e834

15.0.0: drop 72_all_PR117363-revert.patch

Fixed upstream.

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

 15.0.0/gentoo/72_all_PR117363-revert.patch | 106 -----------------------------
 1 file changed, 106 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR117363-revert.patch b/15.0.0/gentoo/72_all_PR117363-revert.patch
deleted file mode 100644
index 3e5be35..0000000
--- a/15.0.0/gentoo/72_all_PR117363-revert.patch
+++ /dev/null
@@ -1,106 +0,0 @@
-From a7df875788d7303639123771af1f4238e207f442 Mon Sep 17 00:00:00 2001
-Message-ID: <a7df875788d7303639123771af1f4238e207f442.1730304104.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Wed, 30 Oct 2024 15:59:01 +0000
-Subject: [PATCH] Revert "Match: Simplify (x != 0 ? x + ~0 : 0) to (x - x !=
- 0)."
-
-This reverts commit 4af8db3eca12b2db3753ce4b098cbd0ae32b4796.
-
-Bug: https://gcc.gnu.org/PR117363
----
- gcc/match.pd                               | 10 ---------
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c | 26 ----------------------
- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c | 26 ----------------------
- 3 files changed, 62 deletions(-)
- delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
- delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
-
-diff --git a/gcc/match.pd b/gcc/match.pd
-index c851ac56e37c..809c717bc862 100644
---- a/gcc/match.pd
-+++ b/gcc/match.pd
-@@ -3391,16 +3391,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
-   }
-   (if (wi::eq_p (sum, wi::uhwi (0, precision)))))))
- 
--/* The boundary condition for case 10: IMM = 1:
--   SAT_U_SUB = X >= IMM ? (X - IMM) : 0.
--   simplify (X != 0 ? X + ~0 : 0) to (X - X != 0).  */
--(simplify
-- (cond (ne@1 @0 integer_zerop)
--       (nop_convert? (plus (nop_convert? @0) integer_all_onesp))
--       integer_zerop)
-- (if (INTEGRAL_TYPE_P (type))
--   (minus @0 (convert @1))))
--
- /* Signed saturation sub, case 1:
-    T minus = (T)((UT)X - (UT)Y);
-    SAT_S_SUB = (X ^ Y) & (X ^ minus) < 0 ? (-(T)(X < 0) ^ MAX) : minus;
-diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
-deleted file mode 100644
-index 962bf0954f62..000000000000
---- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-44.c
-+++ /dev/null
-@@ -1,26 +0,0 @@
--/* { dg-do compile } */
--/* { dg-options "-O2 -fdump-tree-phiopt1" } */
--
--#include <stdint.h>
--
--uint8_t f1 (uint8_t x)
--{
--  return x >= (uint8_t)1 ? x - (uint8_t)1 : 0;
--}
--
--uint16_t f2 (uint16_t x)
--{
--  return x >= (uint16_t)1 ? x - (uint16_t)1 : 0;
--}
--
--uint32_t f3 (uint32_t x)
--{
--  return x >= (uint32_t)1 ? x - (uint32_t)1 : 0;
--}
--
--uint64_t f4 (uint64_t x)
--{
--  return x >= (uint64_t)1 ? x - (uint64_t)1 : 0;
--}
--
--/* { dg-final { scan-tree-dump-not "goto" "phiopt1" } } */
-diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
-deleted file mode 100644
-index 62a2ab631846..000000000000
---- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-45.c
-+++ /dev/null
-@@ -1,26 +0,0 @@
--/* { dg-do compile } */
--/* { dg-options "-O2 -fdump-tree-phiopt1" } */
--
--#include <stdint.h>
--
--int8_t f1 (int8_t x)
--{
--  return x != 0 ? x - (int8_t)1 : 0;
--}
--
--int16_t f2 (int16_t x)
--{
--  return x != 0 ? x - (int16_t)1 : 0;
--}
--
--int32_t f3 (int32_t x)
--{
--  return x != 0 ? x - (int32_t)1 : 0;
--}
--
--int64_t f4 (int64_t x)
--{
--  return x != 0 ? x - (int64_t)1 : 0;
--}
--
--/* { dg-final { scan-tree-dump-not "goto" "phiopt1" } } */
--- 
-2.47.0
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-07 16:13 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-07 16:13 UTC (permalink / raw
  To: gentoo-commits

commit:     5f55e0a35a6595391420057c748c94110a41cacd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov  7 16:13:27 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov  7 16:13:27 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5f55e0a3

15.0.0: add 72_all_PR117476-revert.patch

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

 15.0.0/gentoo/72_all_PR117476-revert.patch | 74 ++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/15.0.0/gentoo/72_all_PR117476-revert.patch b/15.0.0/gentoo/72_all_PR117476-revert.patch
new file mode 100644
index 0000000..c073213
--- /dev/null
+++ b/15.0.0/gentoo/72_all_PR117476-revert.patch
@@ -0,0 +1,74 @@
+From 7f98f96e02bd3b5cac35655d933382f9225fef59 Mon Sep 17 00:00:00 2001
+Message-ID: <7f98f96e02bd3b5cac35655d933382f9225fef59.1730995976.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Thu, 7 Nov 2024 16:12:40 +0000
+Subject: [PATCH] Revert "[PATCH v2] RISC-V: zero_extend(not) -> xor
+ optimization [PR112398]"
+
+This reverts commit 69bd93c167fefbdff0cb88614275358b7a2b2941.
+
+Bug: https://gcc.gnu.org/PR117476
+---
+ gcc/simplify-rtx.cc                       | 22 ----------------------
+ gcc/testsuite/gcc.target/riscv/pr112398.c | 14 --------------
+ 2 files changed, 36 deletions(-)
+ delete mode 100644 gcc/testsuite/gcc.target/riscv/pr112398.c
+
+diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
+index d05efac20dc8..893c5f6e1ae0 100644
+--- a/gcc/simplify-rtx.cc
++++ b/gcc/simplify-rtx.cc
+@@ -1842,28 +1842,6 @@ simplify_context::simplify_unary_operation_1 (rtx_code code, machine_mode mode,
+ 	      & ~GET_MODE_MASK (op_mode)) == 0)
+ 	return SUBREG_REG (op);
+ 
+-      /* Trying to optimize:
+-	 (zero_extend:M (subreg:N (not:M (X:M)))) ->
+-	 (xor:M (zero_extend:M (subreg:N (X:M)), mask))
+-	 where the mask is GET_MODE_MASK (N).
+-	 For the cases when X:M doesn't have any non-zero bits
+-	 outside of mode N, (zero_extend:M (subreg:N (X:M))
+-	 will be simplified to just (X:M)
+-	 and whole optimization will be -> (xor:M (X:M, mask)).  */
+-      if (SUBREG_P (op)
+-	  && GET_CODE (XEXP (op, 0)) == NOT
+-	  && GET_MODE (XEXP (op, 0)) == mode
+-	  && subreg_lowpart_p (op)
+-	  && GET_MODE_SIZE (GET_MODE (op)).is_constant ()
+-	  && (nonzero_bits (XEXP (XEXP (op, 0), 0), mode)
+-	      & ~GET_MODE_MASK (mode)) == 0)
+-      {
+-	const uint64_t mask = GET_MODE_MASK (GET_MODE (op));
+-	return simplify_gen_binary (XOR, mode,
+-				    XEXP (XEXP (op, 0), 0),
+-				    gen_int_mode (mask, mode));
+-      }
+-
+ #if defined(POINTERS_EXTEND_UNSIGNED)
+       /* As we do not know which address space the pointer is referring to,
+ 	 we can do this only if the target does not support different pointer
+diff --git a/gcc/testsuite/gcc.target/riscv/pr112398.c b/gcc/testsuite/gcc.target/riscv/pr112398.c
+deleted file mode 100644
+index 624a665b76c9..000000000000
+--- a/gcc/testsuite/gcc.target/riscv/pr112398.c
++++ /dev/null
+@@ -1,14 +0,0 @@
+-/* { dg-do compile } */
+-/* { dg-options "-march=rv64gc -mabi=lp64d" } */
+-/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */
+-
+-#include <stdint.h>
+-
+-uint8_t neg_u8 (const uint8_t src)
+-{
+-  return ~src;
+-}
+-
+-/* { dg-final { scan-assembler-times "xori\t" 1 } } */
+-/* { dg-final { scan-assembler-not "not\t" } } */
+-/* { dg-final { scan-assembler-not "andi\t" } } */
+
+base-commit: 6a6b8b847bce78a909379f3b9d3365c4ac4f0ff5
+-- 
+2.47.0
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-08  8:22 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-08  8:22 UTC (permalink / raw
  To: gentoo-commits

commit:     d233b7b4ed5b56b7f0291ae3c59c9d6f84120692
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  8 08:22:01 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov  8 08:22:40 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d233b7b4

15.0.0: add workaround for recursion in sccvn

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

 ...93-sccvn-insert_predicates_for_cond-limit.patch | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/15.0.0/gentoo/73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch b/15.0.0/gentoo/73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch
new file mode 100644
index 0000000..2000754
--- /dev/null
+++ b/15.0.0/gentoo/73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch
@@ -0,0 +1,41 @@
+https://gcc.gnu.org/PR117493
+https://gcc.gnu.org/PR117496
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117493#c5
+--- a/gcc/tree-ssa-sccvn.cc
++++ b/gcc/tree-ssa-sccvn.cc
+@@ -7902,8 +7902,11 @@ insert_related_predicates_on_edge (enum tree_code code, tree *ops, edge pred_e)
+    derived from LHS CODE RHS.  */
+ static void
+ insert_predicates_for_cond (tree_code code, tree lhs, tree rhs,
+-			    edge true_e, edge false_e)
++			    edge true_e, edge false_e, int n = 0)
+ {
++  if (n > 5)
++    return;
++
+   /* If both edges are null, then there is nothing to be done. */
+   if (!true_e && !false_e)
+     return;
+@@ -7964,7 +7967,7 @@ insert_predicates_for_cond (tree_code code, tree lhs, tree rhs,
+ 	    edge nf = false_e;
+ 	    if (code == EQ_EXPR)
+ 	      std::swap (nt, nf);
+-	    insert_predicates_for_cond (nc, nlhs, nrhs, nt, nf);
++	    insert_predicates_for_cond (nc, nlhs, nrhs, nt, nf, n + 1);
+ 	  }
+       /* (a | b) == 0 ->
+ 	    on true edge assert: a == 0 & b == 0. */
+@@ -7977,10 +7980,10 @@ insert_predicates_for_cond (tree_code code, tree lhs, tree rhs,
+ 	  tree nlhs;
+ 
+ 	  nlhs = vn_valueize (gimple_assign_rhs1 (def_stmt));
+-	  insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr);
++	  insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr, n + 1);
+ 
+ 	  nlhs = vn_valueize (gimple_assign_rhs2 (def_stmt));
+-	  insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr);
++	  insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr, n + 1);
+ 	}
+     }
+ }


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-09  7:55 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-09  7:55 UTC (permalink / raw
  To: gentoo-commits

commit:     a6cc1808601268d37a0c43ad67b5c116d9678c4d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  9 07:55:37 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov  9 07:55:37 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=a6cc1808

15.0.0: update 73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch

This version will be committed shortly.

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

 ...93-sccvn-insert_predicates_for_cond-limit.patch | 107 ++++++++++++++++-----
 1 file changed, 82 insertions(+), 25 deletions(-)

diff --git a/15.0.0/gentoo/73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch b/15.0.0/gentoo/73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch
index 2000754..9816e52 100644
--- a/15.0.0/gentoo/73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch
+++ b/15.0.0/gentoo/73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch
@@ -1,41 +1,98 @@
-https://gcc.gnu.org/PR117493
-https://gcc.gnu.org/PR117496
+From a49a60790ae2032dfeee617ba9488fc80e09b3a8 Mon Sep 17 00:00:00 2001
+Message-ID: <a49a60790ae2032dfeee617ba9488fc80e09b3a8.1731138919.git.sam@gentoo.org>
+From: Andrew Pinski <quic_apinski@quicinc.com>
+Date: Fri, 8 Nov 2024 17:35:02 -0800
+Subject: [PATCH] VN: Don't recurse on for the same value of `a | b` [PR117496]
 
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117493#c5
+After adding vn_valueize to the handle the `a | b ==/!= 0` case
+of insert_predicates_for_cond, it would go into an infinite loop
+as the Value number for either a or b could be the same as what it
+is for the whole expression. This avoids that recursion so there is
+no infinite loop here.
+
+Bootstrapped and tested on x86_64-linux.
+
+	PR tree-optimization/117496
+
+gcc/ChangeLog:
+
+	* tree-ssa-sccvn.cc (insert_predicates_for_cond): If the
+	valueization for the new lhs is the same as the old one,
+	don't recurse.
+
+gcc/testsuite/ChangeLog:
+
+	* gcc.dg/torture/pr117496-1.c: New test.
+
+Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
+---
+ gcc/testsuite/gcc.dg/torture/pr117496-1.c | 25 +++++++++++++++++++++++
+ gcc/tree-ssa-sccvn.cc                     | 11 ++++++++--
+ 2 files changed, 34 insertions(+), 2 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/torture/pr117496-1.c
+
+diff --git a/gcc/testsuite/gcc.dg/torture/pr117496-1.c b/gcc/testsuite/gcc.dg/torture/pr117496-1.c
+new file mode 100644
+index 000000000000..f35d13dfa85d
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/torture/pr117496-1.c
+@@ -0,0 +1,25 @@
++/* { dg-do compile } */
++
++
++/* PR tree-optimization/117496 */
++/* This would go into an infinite loop into VN while recording
++   the predicates for the `tracks == 0 && wm == 0` GIMPLE_COND.
++   As wm_N and tracks_N would valueize back to `tracks | wm`.  */
++
++int main_argc, gargs_preemp, gargs_nopreemp;
++static void gargs();
++void main_argv() {
++  int tracks = 0;
++  gargs(main_argc, main_argv, &tracks);
++}
++void gargs(int, char *, int *tracksp) {
++  int tracks = *tracksp, wm;
++  for (;;) {
++    if (tracks == 0)
++      wm |= 4;
++    if (gargs_nopreemp)
++      gargs_preemp = 0;
++    if (tracks == 0 && wm == 0)
++      tracks++;
++  }
++}
+diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
+index 1967bbdca84d..9c460fc1bdb3 100644
 --- a/gcc/tree-ssa-sccvn.cc
 +++ b/gcc/tree-ssa-sccvn.cc
-@@ -7902,8 +7902,11 @@ insert_related_predicates_on_edge (enum tree_code code, tree *ops, edge pred_e)
+@@ -7897,6 +7897,7 @@ insert_related_predicates_on_edge (enum tree_code code, tree *ops, edge pred_e)
+ 
+ /* Insert on the TRUE_E true and FALSE_E false predicates
     derived from LHS CODE RHS.  */
++
  static void
  insert_predicates_for_cond (tree_code code, tree lhs, tree rhs,
--			    edge true_e, edge false_e)
-+			    edge true_e, edge false_e, int n = 0)
- {
-+  if (n > 5)
-+    return;
-+
-   /* If both edges are null, then there is nothing to be done. */
-   if (!true_e && !false_e)
-     return;
-@@ -7964,7 +7967,7 @@ insert_predicates_for_cond (tree_code code, tree lhs, tree rhs,
- 	    edge nf = false_e;
- 	    if (code == EQ_EXPR)
- 	      std::swap (nt, nf);
--	    insert_predicates_for_cond (nc, nlhs, nrhs, nt, nf);
-+	    insert_predicates_for_cond (nc, nlhs, nrhs, nt, nf, n + 1);
- 	  }
-       /* (a | b) == 0 ->
- 	    on true edge assert: a == 0 & b == 0. */
-@@ -7977,10 +7980,10 @@ insert_predicates_for_cond (tree_code code, tree lhs, tree rhs,
+ 			    edge true_e, edge false_e)
+@@ -7973,10 +7974,16 @@ insert_predicates_for_cond (tree_code code, tree lhs, tree rhs,
  	  tree nlhs;
  
  	  nlhs = vn_valueize (gimple_assign_rhs1 (def_stmt));
 -	  insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr);
-+	  insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr, n + 1);
++	  /* A valueization of the `a` might return the old lhs
++	     which is already handled above. */
++	  if (nlhs != lhs)
++	    insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr);
  
++	  /* A valueization of the `b` might return the old lhs
++	     which is already handled above. */
  	  nlhs = vn_valueize (gimple_assign_rhs2 (def_stmt));
 -	  insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr);
-+	  insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr, n + 1);
++	  if (nlhs != lhs)
++	    insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr);
  	}
      }
  }
+-- 
+2.47.0
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-09 16:24 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-09 16:24 UTC (permalink / raw
  To: gentoo-commits

commit:     58deeb29d8c568e8e0a633a8b6410d3a70b2808d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  9 16:24:14 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov  9 16:24:42 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=58deeb29

15.0.0: drop 73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch

Merged upstream.

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

 ...93-sccvn-insert_predicates_for_cond-limit.patch | 98 ----------------------
 1 file changed, 98 deletions(-)

diff --git a/15.0.0/gentoo/73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch b/15.0.0/gentoo/73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch
deleted file mode 100644
index 9816e52..0000000
--- a/15.0.0/gentoo/73_all_PR117493-sccvn-insert_predicates_for_cond-limit.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From a49a60790ae2032dfeee617ba9488fc80e09b3a8 Mon Sep 17 00:00:00 2001
-Message-ID: <a49a60790ae2032dfeee617ba9488fc80e09b3a8.1731138919.git.sam@gentoo.org>
-From: Andrew Pinski <quic_apinski@quicinc.com>
-Date: Fri, 8 Nov 2024 17:35:02 -0800
-Subject: [PATCH] VN: Don't recurse on for the same value of `a | b` [PR117496]
-
-After adding vn_valueize to the handle the `a | b ==/!= 0` case
-of insert_predicates_for_cond, it would go into an infinite loop
-as the Value number for either a or b could be the same as what it
-is for the whole expression. This avoids that recursion so there is
-no infinite loop here.
-
-Bootstrapped and tested on x86_64-linux.
-
-	PR tree-optimization/117496
-
-gcc/ChangeLog:
-
-	* tree-ssa-sccvn.cc (insert_predicates_for_cond): If the
-	valueization for the new lhs is the same as the old one,
-	don't recurse.
-
-gcc/testsuite/ChangeLog:
-
-	* gcc.dg/torture/pr117496-1.c: New test.
-
-Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
----
- gcc/testsuite/gcc.dg/torture/pr117496-1.c | 25 +++++++++++++++++++++++
- gcc/tree-ssa-sccvn.cc                     | 11 ++++++++--
- 2 files changed, 34 insertions(+), 2 deletions(-)
- create mode 100644 gcc/testsuite/gcc.dg/torture/pr117496-1.c
-
-diff --git a/gcc/testsuite/gcc.dg/torture/pr117496-1.c b/gcc/testsuite/gcc.dg/torture/pr117496-1.c
-new file mode 100644
-index 000000000000..f35d13dfa85d
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/torture/pr117496-1.c
-@@ -0,0 +1,25 @@
-+/* { dg-do compile } */
-+
-+
-+/* PR tree-optimization/117496 */
-+/* This would go into an infinite loop into VN while recording
-+   the predicates for the `tracks == 0 && wm == 0` GIMPLE_COND.
-+   As wm_N and tracks_N would valueize back to `tracks | wm`.  */
-+
-+int main_argc, gargs_preemp, gargs_nopreemp;
-+static void gargs();
-+void main_argv() {
-+  int tracks = 0;
-+  gargs(main_argc, main_argv, &tracks);
-+}
-+void gargs(int, char *, int *tracksp) {
-+  int tracks = *tracksp, wm;
-+  for (;;) {
-+    if (tracks == 0)
-+      wm |= 4;
-+    if (gargs_nopreemp)
-+      gargs_preemp = 0;
-+    if (tracks == 0 && wm == 0)
-+      tracks++;
-+  }
-+}
-diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
-index 1967bbdca84d..9c460fc1bdb3 100644
---- a/gcc/tree-ssa-sccvn.cc
-+++ b/gcc/tree-ssa-sccvn.cc
-@@ -7897,6 +7897,7 @@ insert_related_predicates_on_edge (enum tree_code code, tree *ops, edge pred_e)
- 
- /* Insert on the TRUE_E true and FALSE_E false predicates
-    derived from LHS CODE RHS.  */
-+
- static void
- insert_predicates_for_cond (tree_code code, tree lhs, tree rhs,
- 			    edge true_e, edge false_e)
-@@ -7973,10 +7974,16 @@ insert_predicates_for_cond (tree_code code, tree lhs, tree rhs,
- 	  tree nlhs;
- 
- 	  nlhs = vn_valueize (gimple_assign_rhs1 (def_stmt));
--	  insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr);
-+	  /* A valueization of the `a` might return the old lhs
-+	     which is already handled above. */
-+	  if (nlhs != lhs)
-+	    insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr);
- 
-+	  /* A valueization of the `b` might return the old lhs
-+	     which is already handled above. */
- 	  nlhs = vn_valueize (gimple_assign_rhs2 (def_stmt));
--	  insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr);
-+	  if (nlhs != lhs)
-+	    insert_predicates_for_cond (EQ_EXPR, nlhs, rhs, e, nullptr);
- 	}
-     }
- }
--- 
-2.47.0
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-10 22:41 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-10 22:41 UTC (permalink / raw
  To: gentoo-commits

commit:     eebe373c98a3d9a22f3dadab26f1fadb7220f60c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 10 22:40:37 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov 10 22:40:37 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=eebe373c

15.0.0: cut patchset 22

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

 15.0.0/gentoo/README.history | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 2d6aaf8..25ab12b 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+22	10 November 2024
+
+	+ 72_all_PR117476-revert.patch
+
 21	1 November 2024
 
 	+ 31_all_time64.patch	


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-11 19:46 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-11 19:46 UTC (permalink / raw
  To: gentoo-commits

commit:     9bb90d6a35c8ab572372dfcff42a0ecd7dd53952
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 11 19:44:42 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 11 19:44:42 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9bb90d6a

15.0.0: add 33_all_PR80677-cross-limits.patch

I needed this with a cross from amd64->s390 after doing crossdev as
normal but then upgrading them to 15 snapshots.

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

 15.0.0/gentoo/33_all_PR80677-cross-limits.patch | 38 +++++++++++++++++++++++++
 15.0.0/gentoo/README.history                    |  4 +++
 2 files changed, 42 insertions(+)

diff --git a/15.0.0/gentoo/33_all_PR80677-cross-limits.patch b/15.0.0/gentoo/33_all_PR80677-cross-limits.patch
new file mode 100644
index 0000000..3cbef01
--- /dev/null
+++ b/15.0.0/gentoo/33_all_PR80677-cross-limits.patch
@@ -0,0 +1,38 @@
+https://gcc.gnu.org/PR80677
+--- a/gcc/limitx.h
++++ b/gcc/limitx.h
+@@ -29,7 +29,7 @@
+ #ifndef _GCC_LIMITS_H_  /* Terminated in limity.h.  */
+ #define _GCC_LIMITS_H_
+
+-#ifndef _LIBC_LIMITS_H_
++#if !defined(_LIBC_LIMITS_H_) && __has_include_next(<limits.h>)
+ /* Use "..." so that we find syslimits.h only in this same directory.  */
+ #include "syslimits.h"
+ #endif
+--- a/gcc/limity.h
++++ b/gcc/limity.h
+@@ -3,7 +3,7 @@
+
+ #else /* not _GCC_LIMITS_H_ */
+
+-#ifdef _GCC_NEXT_LIMITS_H
++#if defined(_GCC_NEXT_LIMITS_H) && __has_include_next(<limits.h>)
+ #include_next <limits.h>		/* recurse down to the real one */
+ #endif
+
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -3344,11 +3344,7 @@ stmp-int-hdrs: $(STMP_FIXINC) $(T_GLIMITS_H) $(T_STDINT_GCC_H) $(USER_H) fixinc_
+ 	  sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \
+ 	  multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
+ 	  include_dir=include$${multi_dir}; \
+-	  if $(LIMITS_H_TEST) ; then \
+-	    cat $(srcdir)/limitx.h $(T_GLIMITS_H) $(srcdir)/limity.h > tmp-xlimits.h; \
+-	  else \
+-	    cat $(T_GLIMITS_H) > tmp-xlimits.h; \
+-	  fi; \
++	  cat $(srcdir)/limitx.h $(T_GLIMITS_H) $(srcdir)/limity.h > tmp-xlimits.h; \
+ 	  $(mkinstalldirs) $${include_dir}; \
+ 	  chmod a+rx $${include_dir} || true; \
+ 	  $(SHELL) $(srcdir)/../move-if-change \

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 25ab12b..dbf2b56 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+23	11 November 2024
+
+	+ 33_all_PR80677-cross-limits.patch
+
 22	10 November 2024
 
 	+ 72_all_PR117476-revert.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-11 19:46 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-11 19:46 UTC (permalink / raw
  To: gentoo-commits

commit:     c19b98e5b8997c997dbde31fe6d6db895b37dca7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 11 19:45:15 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 11 19:45:15 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c19b98e5

15.0.0: rename 31_all_time64.patch -> 32_all_time64.patch

Numbering conflict.

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

 15.0.0/gentoo/{31_all_time64.patch => 32_all_time64.patch} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/15.0.0/gentoo/31_all_time64.patch b/15.0.0/gentoo/32_all_time64.patch
similarity index 100%
rename from 15.0.0/gentoo/31_all_time64.patch
rename to 15.0.0/gentoo/32_all_time64.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-12  2:33 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-12  2:33 UTC (permalink / raw
  To: gentoo-commits

commit:     8209a4e7304772b31beca172c0397c76bcee4876
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 12 02:33:40 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Nov 12 02:33:40 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8209a4e7

15.0.0: rebase 26_all_enable-cet.patch

-fmodules-ts was renamed to -fmodules.

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

 15.0.0/gentoo/26_all_enable-cet.patch | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/15.0.0/gentoo/26_all_enable-cet.patch b/15.0.0/gentoo/26_all_enable-cet.patch
index b9bbbf0..85591e9 100644
--- a/15.0.0/gentoo/26_all_enable-cet.patch
+++ b/15.0.0/gentoo/26_all_enable-cet.patch
@@ -11,34 +11,34 @@ Needs:
 Only supported on amd64.
 --- a/gcc/cp/lang-specs.h
 +++ b/gcc/cp/lang-specs.h
-@@ -51,7 +51,7 @@ along with GCC; see the file COPYING3.  If not see
+@@ -57,7 +57,7 @@ along with GCC; see the file COPYING3.  If not see
        " 	   %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}"
        "  %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}"
-       "  %{fmodules-ts:-fmodule-header %{fpreprocessed:-fdirectives-only}}"
+       "  %{fmodules*:-fmodule-header %{fpreprocessed:-fdirectives-only}}"
 -      "  %(cc1_options) %2"
 +      "  %(cc1_options) %(default_flag_cf_spec) %2"
        "  %{!fsyntax-only:"
        "    %{!S:-o %g.s}"
-       "    %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
-@@ -72,7 +72,7 @@ along with GCC; see the file COPYING3.  If not see
+       "    %{!fmodule-*:%{!fmodules*:%{!fdump-ada-spec*:"
+@@ -78,7 +78,7 @@ along with GCC; see the file COPYING3.  If not see
        "  %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}"
-       "  %{fmodules-ts:-fmodule-header=system"
+       "  %{fmodules*:-fmodule-header=system"
        "    %{fpreprocessed:-fdirectives-only}}"
 -      "  %(cc1_options) %2"
 +      "  %(cc1_options) %(default_flag_cf_spec) %2"
        "  %{!fsyntax-only:"
        "    %{!S:-o %g.s}"
-       "    %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
-@@ -92,7 +92,7 @@ along with GCC; see the file COPYING3.  If not see
+       "    %{!fmodule-*:%{!fmodules*:%{!fdump-ada-spec*:"
+@@ -98,7 +98,7 @@ along with GCC; see the file COPYING3.  If not see
        " 	   %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}"
        "  %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}"
-       "  %{fmodules-ts:-fmodule-header=user %{fpreprocessed:-fdirectives-only}}"
+       "  %{fmodules*:-fmodule-header=user %{fpreprocessed:-fdirectives-only}}"
 -      "  %(cc1_options) %2"
 +      "  %(cc1_options) %(default_flag_cf_spec) %2"
        "  %{!fsyntax-only:"
        "    %{!S:-o %g.s}"
-       "    %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
-@@ -107,7 +107,7 @@ along with GCC; see the file COPYING3.  If not see
+       "    %{!fmodule-*:%{!fmodules*:%{!fdump-ada-spec*:"
+@@ -113,7 +113,7 @@ along with GCC; see the file COPYING3.  If not see
        "  cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed"
        " 	   %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}"
        "  %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}"
@@ -47,7 +47,7 @@ Only supported on amd64.
        "  %{!fsyntax-only:"
        "    %{fmodule-only:%{!S:-o %g.s%V}}"
        "    %{!fmodule-only:%(invoke_as)}}"
-@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3.  If not see
+@@ -122,7 +122,7 @@ along with GCC; see the file COPYING3.  If not see
    {".ii", "@c++-cpp-output", 0, 0, 0},
    {"@c++-cpp-output",
        "%{!E:%{!M:%{!MM:"
@@ -58,7 +58,7 @@ Only supported on amd64.
        "    %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}"
 --- a/gcc/gcc.cc
 +++ b/gcc/gcc.cc
-@@ -999,6 +999,18 @@ proper position among the other output files.  */
+@@ -1011,6 +1011,18 @@ proper position among the other output files.  */
  #define LINK_NOW_SPEC ""
  #endif
  
@@ -77,7 +77,7 @@ Only supported on amd64.
  #ifdef ENABLE_DEFAULT_PIE
  #define PIE_SPEC		"!no-pie"
  #define NO_FPIE1_SPEC		"fno-pie"
-@@ -1201,6 +1213,7 @@ static const char *cpp_spec = CPP_SPEC;
+@@ -1217,6 +1229,7 @@ static const char *cpp_spec = CPP_SPEC;
  static const char *cc1_spec = CC1_SPEC OS_CC1_SPEC;
  static const char *cc1plus_spec = CC1PLUS_SPEC;
  static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
@@ -85,7 +85,7 @@ Only supported on amd64.
  static const char *link_ssp_spec = LINK_SSP_SPEC;
  static const char *asm_spec = ASM_SPEC;
  static const char *asm_final_spec = ASM_FINAL_SPEC;
-@@ -1261,7 +1274,7 @@ static const char *cpp_options =
+@@ -1277,7 +1290,7 @@ static const char *cpp_options =
  "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
   %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
   %{!fno-working-directory:-fworking-directory}}} %{O*}\
@@ -94,7 +94,7 @@ Only supported on amd64.
  
  /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
  
-@@ -1455,9 +1468,9 @@ static const struct compiler default_compilers[] =
+@@ -1471,9 +1484,9 @@ static const struct compiler default_compilers[] =
        %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
  	  %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
  	    cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
@@ -106,7 +106,7 @@ Only supported on amd64.
        %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1},
    {"-",
     "%{!E:%e-E or -x required when input is from standard input}\
-@@ -1482,7 +1495,7 @@ static const struct compiler default_compilers[] =
+@@ -1498,7 +1511,7 @@ static const struct compiler default_compilers[] =
  					   %W{o*:--output-pch %w%*}}%{!S:%V}}}}}}}}", 0, 0, 0},
    {".i", "@cpp-output", 0, 0, 0},
    {"@cpp-output",
@@ -115,7 +115,7 @@ Only supported on amd64.
    {".s", "@assembler", 0, 0, 0},
    {"@assembler",
     "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
-@@ -1714,6 +1727,7 @@ static struct spec_list static_specs[] =
+@@ -1730,6 +1743,7 @@ static struct spec_list static_specs[] =
    INIT_STATIC_SPEC ("cc1_options",		&cc1_options),
    INIT_STATIC_SPEC ("cc1plus",			&cc1plus_spec),
    INIT_STATIC_SPEC ("link_gcc_c_sequence",	&link_gcc_c_sequence_spec),


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-13  0:16 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-13  0:16 UTC (permalink / raw
  To: gentoo-commits

commit:     dc56acd66a2e3cbbc1f1a62f02538d668f4a843b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 13 00:16:04 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 13 00:16:04 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=dc56acd6

15.0.0: drop 72_all_PR117476-revert.patch

The revert has landed upstream.

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

 15.0.0/gentoo/72_all_PR117476-revert.patch | 74 ------------------------------
 1 file changed, 74 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR117476-revert.patch b/15.0.0/gentoo/72_all_PR117476-revert.patch
deleted file mode 100644
index c073213..0000000
--- a/15.0.0/gentoo/72_all_PR117476-revert.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 7f98f96e02bd3b5cac35655d933382f9225fef59 Mon Sep 17 00:00:00 2001
-Message-ID: <7f98f96e02bd3b5cac35655d933382f9225fef59.1730995976.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Thu, 7 Nov 2024 16:12:40 +0000
-Subject: [PATCH] Revert "[PATCH v2] RISC-V: zero_extend(not) -> xor
- optimization [PR112398]"
-
-This reverts commit 69bd93c167fefbdff0cb88614275358b7a2b2941.
-
-Bug: https://gcc.gnu.org/PR117476
----
- gcc/simplify-rtx.cc                       | 22 ----------------------
- gcc/testsuite/gcc.target/riscv/pr112398.c | 14 --------------
- 2 files changed, 36 deletions(-)
- delete mode 100644 gcc/testsuite/gcc.target/riscv/pr112398.c
-
-diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
-index d05efac20dc8..893c5f6e1ae0 100644
---- a/gcc/simplify-rtx.cc
-+++ b/gcc/simplify-rtx.cc
-@@ -1842,28 +1842,6 @@ simplify_context::simplify_unary_operation_1 (rtx_code code, machine_mode mode,
- 	      & ~GET_MODE_MASK (op_mode)) == 0)
- 	return SUBREG_REG (op);
- 
--      /* Trying to optimize:
--	 (zero_extend:M (subreg:N (not:M (X:M)))) ->
--	 (xor:M (zero_extend:M (subreg:N (X:M)), mask))
--	 where the mask is GET_MODE_MASK (N).
--	 For the cases when X:M doesn't have any non-zero bits
--	 outside of mode N, (zero_extend:M (subreg:N (X:M))
--	 will be simplified to just (X:M)
--	 and whole optimization will be -> (xor:M (X:M, mask)).  */
--      if (SUBREG_P (op)
--	  && GET_CODE (XEXP (op, 0)) == NOT
--	  && GET_MODE (XEXP (op, 0)) == mode
--	  && subreg_lowpart_p (op)
--	  && GET_MODE_SIZE (GET_MODE (op)).is_constant ()
--	  && (nonzero_bits (XEXP (XEXP (op, 0), 0), mode)
--	      & ~GET_MODE_MASK (mode)) == 0)
--      {
--	const uint64_t mask = GET_MODE_MASK (GET_MODE (op));
--	return simplify_gen_binary (XOR, mode,
--				    XEXP (XEXP (op, 0), 0),
--				    gen_int_mode (mask, mode));
--      }
--
- #if defined(POINTERS_EXTEND_UNSIGNED)
-       /* As we do not know which address space the pointer is referring to,
- 	 we can do this only if the target does not support different pointer
-diff --git a/gcc/testsuite/gcc.target/riscv/pr112398.c b/gcc/testsuite/gcc.target/riscv/pr112398.c
-deleted file mode 100644
-index 624a665b76c9..000000000000
---- a/gcc/testsuite/gcc.target/riscv/pr112398.c
-+++ /dev/null
-@@ -1,14 +0,0 @@
--/* { dg-do compile } */
--/* { dg-options "-march=rv64gc -mabi=lp64d" } */
--/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */
--
--#include <stdint.h>
--
--uint8_t neg_u8 (const uint8_t src)
--{
--  return ~src;
--}
--
--/* { dg-final { scan-assembler-times "xori\t" 1 } } */
--/* { dg-final { scan-assembler-not "not\t" } } */
--/* { dg-final { scan-assembler-not "andi\t" } } */
-
-base-commit: 6a6b8b847bce78a909379f3b9d3365c4ac4f0ff5
--- 
-2.47.0
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-13  4:26 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-13  4:26 UTC (permalink / raw
  To: gentoo-commits

commit:     103f6d1d6a6291a214d420a6279ebe3a99b83981
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 13 04:26:15 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 13 04:26:15 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=103f6d1d

15.0.0: bring back 72_all_PR117476-revert.patch

It seems to have reappeared on trunk...

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

 15.0.0/gentoo/72_all_PR117476-revert.patch | 74 ++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/15.0.0/gentoo/72_all_PR117476-revert.patch b/15.0.0/gentoo/72_all_PR117476-revert.patch
new file mode 100644
index 0000000..35c60bf
--- /dev/null
+++ b/15.0.0/gentoo/72_all_PR117476-revert.patch
@@ -0,0 +1,74 @@
+From df77b7d66ca5dee0130765f37d8afba29f0f1f28 Mon Sep 17 00:00:00 2001
+Message-ID: <df77b7d66ca5dee0130765f37d8afba29f0f1f28.1731471945.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Wed, 13 Nov 2024 04:25:31 +0000
+Subject: [PATCH] Revert "Reapply "[PATCH v2] RISC-V: zero_extend(not) -> xor
+ optimization [PR112398]""
+
+This reverts commit 10d76b7f1e5b63ad6d2b92940c39007913ced037.
+
+Bug: https://gcc.gnu.org/PR117476
+---
+ gcc/simplify-rtx.cc                       | 22 ----------------------
+ gcc/testsuite/gcc.target/riscv/pr112398.c | 14 --------------
+ 2 files changed, 36 deletions(-)
+ delete mode 100644 gcc/testsuite/gcc.target/riscv/pr112398.c
+
+diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
+index d05efac20dc8..893c5f6e1ae0 100644
+--- a/gcc/simplify-rtx.cc
++++ b/gcc/simplify-rtx.cc
+@@ -1842,28 +1842,6 @@ simplify_context::simplify_unary_operation_1 (rtx_code code, machine_mode mode,
+ 	      & ~GET_MODE_MASK (op_mode)) == 0)
+ 	return SUBREG_REG (op);
+ 
+-      /* Trying to optimize:
+-	 (zero_extend:M (subreg:N (not:M (X:M)))) ->
+-	 (xor:M (zero_extend:M (subreg:N (X:M)), mask))
+-	 where the mask is GET_MODE_MASK (N).
+-	 For the cases when X:M doesn't have any non-zero bits
+-	 outside of mode N, (zero_extend:M (subreg:N (X:M))
+-	 will be simplified to just (X:M)
+-	 and whole optimization will be -> (xor:M (X:M, mask)).  */
+-      if (SUBREG_P (op)
+-	  && GET_CODE (XEXP (op, 0)) == NOT
+-	  && GET_MODE (XEXP (op, 0)) == mode
+-	  && subreg_lowpart_p (op)
+-	  && GET_MODE_SIZE (GET_MODE (op)).is_constant ()
+-	  && (nonzero_bits (XEXP (XEXP (op, 0), 0), mode)
+-	      & ~GET_MODE_MASK (mode)) == 0)
+-      {
+-	const uint64_t mask = GET_MODE_MASK (GET_MODE (op));
+-	return simplify_gen_binary (XOR, mode,
+-				    XEXP (XEXP (op, 0), 0),
+-				    gen_int_mode (mask, mode));
+-      }
+-
+ #if defined(POINTERS_EXTEND_UNSIGNED)
+       /* As we do not know which address space the pointer is referring to,
+ 	 we can do this only if the target does not support different pointer
+diff --git a/gcc/testsuite/gcc.target/riscv/pr112398.c b/gcc/testsuite/gcc.target/riscv/pr112398.c
+deleted file mode 100644
+index 624a665b76c9..000000000000
+--- a/gcc/testsuite/gcc.target/riscv/pr112398.c
++++ /dev/null
+@@ -1,14 +0,0 @@
+-/* { dg-do compile } */
+-/* { dg-options "-march=rv64gc -mabi=lp64d" } */
+-/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */
+-
+-#include <stdint.h>
+-
+-uint8_t neg_u8 (const uint8_t src)
+-{
+-  return ~src;
+-}
+-
+-/* { dg-final { scan-assembler-times "xori\t" 1 } } */
+-/* { dg-final { scan-assembler-not "not\t" } } */
+-/* { dg-final { scan-assembler-not "andi\t" } } */
+
+base-commit: 445d8bb6a89eb2275c4930ec87a98d5123e5abdd
+-- 
+2.47.0
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-14 18:38 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-14 18:38 UTC (permalink / raw
  To: gentoo-commits

commit:     1055347293b49e411dc12e767faecfe9dcbfa8cf
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 14 18:37:39 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 14 18:37:39 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=10553472

15.0.0: drop 72_all_PR117476-revert.patch

It's now been properly reverted again.

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

 15.0.0/gentoo/72_all_PR117476-revert.patch | 74 ------------------------------
 1 file changed, 74 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR117476-revert.patch b/15.0.0/gentoo/72_all_PR117476-revert.patch
deleted file mode 100644
index 35c60bf..0000000
--- a/15.0.0/gentoo/72_all_PR117476-revert.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From df77b7d66ca5dee0130765f37d8afba29f0f1f28 Mon Sep 17 00:00:00 2001
-Message-ID: <df77b7d66ca5dee0130765f37d8afba29f0f1f28.1731471945.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Wed, 13 Nov 2024 04:25:31 +0000
-Subject: [PATCH] Revert "Reapply "[PATCH v2] RISC-V: zero_extend(not) -> xor
- optimization [PR112398]""
-
-This reverts commit 10d76b7f1e5b63ad6d2b92940c39007913ced037.
-
-Bug: https://gcc.gnu.org/PR117476
----
- gcc/simplify-rtx.cc                       | 22 ----------------------
- gcc/testsuite/gcc.target/riscv/pr112398.c | 14 --------------
- 2 files changed, 36 deletions(-)
- delete mode 100644 gcc/testsuite/gcc.target/riscv/pr112398.c
-
-diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
-index d05efac20dc8..893c5f6e1ae0 100644
---- a/gcc/simplify-rtx.cc
-+++ b/gcc/simplify-rtx.cc
-@@ -1842,28 +1842,6 @@ simplify_context::simplify_unary_operation_1 (rtx_code code, machine_mode mode,
- 	      & ~GET_MODE_MASK (op_mode)) == 0)
- 	return SUBREG_REG (op);
- 
--      /* Trying to optimize:
--	 (zero_extend:M (subreg:N (not:M (X:M)))) ->
--	 (xor:M (zero_extend:M (subreg:N (X:M)), mask))
--	 where the mask is GET_MODE_MASK (N).
--	 For the cases when X:M doesn't have any non-zero bits
--	 outside of mode N, (zero_extend:M (subreg:N (X:M))
--	 will be simplified to just (X:M)
--	 and whole optimization will be -> (xor:M (X:M, mask)).  */
--      if (SUBREG_P (op)
--	  && GET_CODE (XEXP (op, 0)) == NOT
--	  && GET_MODE (XEXP (op, 0)) == mode
--	  && subreg_lowpart_p (op)
--	  && GET_MODE_SIZE (GET_MODE (op)).is_constant ()
--	  && (nonzero_bits (XEXP (XEXP (op, 0), 0), mode)
--	      & ~GET_MODE_MASK (mode)) == 0)
--      {
--	const uint64_t mask = GET_MODE_MASK (GET_MODE (op));
--	return simplify_gen_binary (XOR, mode,
--				    XEXP (XEXP (op, 0), 0),
--				    gen_int_mode (mask, mode));
--      }
--
- #if defined(POINTERS_EXTEND_UNSIGNED)
-       /* As we do not know which address space the pointer is referring to,
- 	 we can do this only if the target does not support different pointer
-diff --git a/gcc/testsuite/gcc.target/riscv/pr112398.c b/gcc/testsuite/gcc.target/riscv/pr112398.c
-deleted file mode 100644
-index 624a665b76c9..000000000000
---- a/gcc/testsuite/gcc.target/riscv/pr112398.c
-+++ /dev/null
-@@ -1,14 +0,0 @@
--/* { dg-do compile } */
--/* { dg-options "-march=rv64gc -mabi=lp64d" } */
--/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */
--
--#include <stdint.h>
--
--uint8_t neg_u8 (const uint8_t src)
--{
--  return ~src;
--}
--
--/* { dg-final { scan-assembler-times "xori\t" 1 } } */
--/* { dg-final { scan-assembler-not "not\t" } } */
--/* { dg-final { scan-assembler-not "andi\t" } } */
-
-base-commit: 445d8bb6a89eb2275c4930ec87a98d5123e5abdd
--- 
-2.47.0
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-18  9:25 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-18  9:25 UTC (permalink / raw
  To: gentoo-commits

commit:     ff918f6d0aac410a08f27a635f8b622c86097347
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 18 09:25:06 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 18 09:25:06 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ff918f6d

15.0.0: add 72_all_PR117628-libgcc-c23.patch

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

 15.0.0/gentoo/72_all_PR117628-libgcc-c23.patch | 71 ++++++++++++++++++++++++++
 15.0.0/gentoo/README.history                   |  4 ++
 2 files changed, 75 insertions(+)

diff --git a/15.0.0/gentoo/72_all_PR117628-libgcc-c23.patch b/15.0.0/gentoo/72_all_PR117628-libgcc-c23.patch
new file mode 100644
index 0000000..ddfb652
--- /dev/null
+++ b/15.0.0/gentoo/72_all_PR117628-libgcc-c23.patch
@@ -0,0 +1,71 @@
+From b750323260c1ceb47c64e98ddab7095696b00a6d Mon Sep 17 00:00:00 2001
+Message-ID: <b750323260c1ceb47c64e98ddab7095696b00a6d.1731921825.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Mon, 18 Nov 2024 09:22:33 +0000
+Subject: [PATCH] libgcc: fix C23 issues
+
+This includes Jeff's patch from https://inbox.sourceware.org/gcc-patches/9cb69002-9754-476a-a525-68dcca9c23d8@gmail.com/.
+
+Bug: https://gcc.gnu.org/PR117628
+--- a/libgcc/config/arm/linux-atomic-64bit.c
++++ b/libgcc/config/arm/linux-atomic-64bit.c
+@@ -141,9 +141,7 @@ __sync_val_compare_and_swap_8 (long long *ptr, long long oldval,
+     }
+ }
+ 
+-typedef unsigned char bool;
+-
+-bool HIDDEN
++unsigned char HIDDEN
+ __sync_bool_compare_and_swap_8 (long long *ptr, long long oldval,
+ 				 long long newval)
+ {
+--- a/libgcc/config/arm/linux-atomic.c
++++ b/libgcc/config/arm/linux-atomic.c
+@@ -249,9 +249,7 @@ __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
+ SUBWORD_VAL_CAS (short,       2)
+ SUBWORD_VAL_CAS (signed char, 1)
+ 
+-typedef unsigned char bool;
+-
+-bool HIDDEN
++unsigned char HIDDEN
+ __sync_bool_compare_and_swap_4 (int *ptr, int oldval, int newval)
+ {
+   int failure = __kernel_cmpxchg (oldval, newval, ptr);
+@@ -259,7 +257,7 @@ __sync_bool_compare_and_swap_4 (int *ptr, int oldval, int newval)
+ }
+ 
+ #define SUBWORD_BOOL_CAS(TYPE, WIDTH)					\
+-  bool HIDDEN								\
++  unsigned char HIDDEN								\
+   __sync_bool_compare_and_swap_##WIDTH (TYPE *ptr, TYPE oldval,		\
+ 					TYPE newval)			\
+   {									\
+--- a/libgcc/config/csky/linux-atomic.c
++++ b/libgcc/config/csky/linux-atomic.c
+@@ -215,8 +215,6 @@ __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
+ SUBWORD_VAL_CAS (unsigned short, 2)
+ SUBWORD_VAL_CAS (unsigned char,	1)
+ 
+-typedef unsigned char bool;
+-
+ bool HIDDEN
+ __sync_bool_compare_and_swap_4 (int *ptr, int oldval, int newval)
+ {
+--- a/libgcc/unwind-arm-common.inc
++++ b/libgcc/unwind-arm-common.inc
+@@ -52,8 +52,6 @@
+ 
+ /* Definitions for C++ runtime support routines.  We make these weak
+    declarations to avoid pulling in libsupc++ unnecessarily.  */
+-typedef unsigned char bool;
+-
+ typedef struct _ZSt9type_info type_info; /* This names C++ type_info type */
+ enum __cxa_type_match_result
+   {
+
+base-commit: 45a3277149d95a51cf9109cab87ee39a7dce73e2
+-- 
+2.47.0
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 6da1d89..af598af 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+25	18 November 2024
+
+	+ 72_all_PR117628-libgcc-c23.patch
+
 24	16 November 2024
 
 	- 72_all_PR117476-revert.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-18  9:25 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-18  9:25 UTC (permalink / raw
  To: gentoo-commits

commit:     f502c6a7b5a5ea7666dd97267083e7828a7209eb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 18 01:38:06 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 18 01:38:06 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f502c6a7

15.0.0: cut patchset 24

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

 15.0.0/gentoo/README.history | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index dbf2b56..6da1d89 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+24	16 November 2024
+
+	- 72_all_PR117476-revert.patch
+
 23	11 November 2024
 
 	+ 33_all_PR80677-cross-limits.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-18 10:42 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-18 10:42 UTC (permalink / raw
  To: gentoo-commits

commit:     2d962d0ca362f375f13b52ed638a2b183b4cb062
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 18 10:39:22 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 18 10:39:22 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=2d962d0c

15.0.0: add 73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch

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

 ...ch-Fix-the-max-a-b-0-pattern-for-pointers.patch | 83 ++++++++++++++++++++++
 15.0.0/gentoo/README.history                       |  4 ++
 2 files changed, 87 insertions(+)

diff --git a/15.0.0/gentoo/73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch b/15.0.0/gentoo/73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch
new file mode 100644
index 0000000..c0ab935
--- /dev/null
+++ b/15.0.0/gentoo/73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch
@@ -0,0 +1,83 @@
+From 45a3277149d95a51cf9109cab87ee39a7dce73e2 Mon Sep 17 00:00:00 2001
+Message-ID: <45a3277149d95a51cf9109cab87ee39a7dce73e2.1731926298.git.sam@gentoo.org>
+From: Andrew Pinski <quic_apinski@quicinc.com>
+Date: Sun, 17 Nov 2024 20:21:58 -0800
+Subject: [PATCH] match: Fix the `max<a,b>==0` pattern for pointers [PR117646]
+
+For pointers I forgot that BIT_IOR_EXPR is not valid so when
+I added the pattern to convert `max<a,b> != 0` (r15-5356), GCC
+would start to ICEing saying pointer types were not valid for
+BIT_IOR_EXPR.
+This fixes the problem by casting to the unsigned type of the
+inner type. There was another way of fixing this to handling it
+as `a == 0 & b == 0` but both match and reassoication (for pointers)
+will then convert it back into the form I am creating here so
+let's just use that form instead.
+
+Bootstrapped and tested on x86_64-linux-gnu.
+
+	PR tree-optimization/117646
+
+gcc/ChangeLog:
+
+	* match.pd (`max<a,b>==0`): Add casts to `unsigned type`.
+
+gcc/testsuite/ChangeLog:
+
+	* gcc.dg/torture/minmaxneeqptr-1.c: New test.
+
+Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
+---
+ gcc/match.pd                                  |  6 ++++--
+ .../gcc.dg/torture/minmaxneeqptr-1.c          | 21 +++++++++++++++++++
+ 2 files changed, 25 insertions(+), 2 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/torture/minmaxneeqptr-1.c
+
+diff --git a/gcc/match.pd b/gcc/match.pd
+index 4bec24a21b29..f5181325f3b9 100644
+--- a/gcc/match.pd
++++ b/gcc/match.pd
+@@ -4799,9 +4799,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
+    MAX (A, B) != 0 -> (A|B) != 0 iff unsigned.  */
+ (for cmp (eq ne)
+  (simplify
+-  (cmp (max @0 @1) integer_zerop@2)
++  (cmp (max @0 @1) integer_zerop)
+   (if (TYPE_UNSIGNED (TREE_TYPE (@0)))
+-   (cmp (bit_ior @0 @1) @2))))
++   (with { tree utype = unsigned_type_for (TREE_TYPE (@0)); }
++    (cmp (bit_ior (convert:utype @0) (convert:utype @1))
++         { build_zero_cst (utype); } )))))
+ 
+ /* Undo fancy ways of writing max/min or other ?: expressions, like
+    a - ((a - b) & -(a < b))  and  a - (a - b) * (a < b) into (a < b) ? b : a.
+diff --git a/gcc/testsuite/gcc.dg/torture/minmaxneeqptr-1.c b/gcc/testsuite/gcc.dg/torture/minmaxneeqptr-1.c
+new file mode 100644
+index 000000000000..aa45722330f4
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/torture/minmaxneeqptr-1.c
+@@ -0,0 +1,21 @@
++/* { dg-do compile } */
++
++/* PR tree-optimization/117646 */
++
++int maxeq(char *a, char *b) {
++  char *p = a < b ? b : a;
++  return p == (void*)0;
++}
++int maxne(char *a, char *b) {
++  char *p = a < b ? b : a;
++  return p == (void*)0;
++}
++
++int mineq(char *a, char *b) {
++  char *p = a > b ? b : a;
++  return p == (void*)0;
++}
++int minne(char *a, char *b) {
++  char *p = a > b ? b : a;
++  return p == (void*)0;
++}
+-- 
+2.47.0
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index af598af..df484a6 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+26	18 November 2024
+
+	+ 73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch
+
 25	18 November 2024
 
 	+ 72_all_PR117628-libgcc-c23.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-18 10:42 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-18 10:42 UTC (permalink / raw
  To: gentoo-commits

commit:     8174d657315852bd6a17d8d4f8084a54fc6a6f7f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 18 10:41:53 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 18 10:41:59 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8174d657

15.0.0: drop 73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch

Merged upstream.

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

 ...ch-Fix-the-max-a-b-0-pattern-for-pointers.patch | 83 ----------------------
 15.0.0/gentoo/README.history                       |  4 ++
 2 files changed, 4 insertions(+), 83 deletions(-)

diff --git a/15.0.0/gentoo/73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch b/15.0.0/gentoo/73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch
deleted file mode 100644
index c0ab935..0000000
--- a/15.0.0/gentoo/73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From 45a3277149d95a51cf9109cab87ee39a7dce73e2 Mon Sep 17 00:00:00 2001
-Message-ID: <45a3277149d95a51cf9109cab87ee39a7dce73e2.1731926298.git.sam@gentoo.org>
-From: Andrew Pinski <quic_apinski@quicinc.com>
-Date: Sun, 17 Nov 2024 20:21:58 -0800
-Subject: [PATCH] match: Fix the `max<a,b>==0` pattern for pointers [PR117646]
-
-For pointers I forgot that BIT_IOR_EXPR is not valid so when
-I added the pattern to convert `max<a,b> != 0` (r15-5356), GCC
-would start to ICEing saying pointer types were not valid for
-BIT_IOR_EXPR.
-This fixes the problem by casting to the unsigned type of the
-inner type. There was another way of fixing this to handling it
-as `a == 0 & b == 0` but both match and reassoication (for pointers)
-will then convert it back into the form I am creating here so
-let's just use that form instead.
-
-Bootstrapped and tested on x86_64-linux-gnu.
-
-	PR tree-optimization/117646
-
-gcc/ChangeLog:
-
-	* match.pd (`max<a,b>==0`): Add casts to `unsigned type`.
-
-gcc/testsuite/ChangeLog:
-
-	* gcc.dg/torture/minmaxneeqptr-1.c: New test.
-
-Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
----
- gcc/match.pd                                  |  6 ++++--
- .../gcc.dg/torture/minmaxneeqptr-1.c          | 21 +++++++++++++++++++
- 2 files changed, 25 insertions(+), 2 deletions(-)
- create mode 100644 gcc/testsuite/gcc.dg/torture/minmaxneeqptr-1.c
-
-diff --git a/gcc/match.pd b/gcc/match.pd
-index 4bec24a21b29..f5181325f3b9 100644
---- a/gcc/match.pd
-+++ b/gcc/match.pd
-@@ -4799,9 +4799,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
-    MAX (A, B) != 0 -> (A|B) != 0 iff unsigned.  */
- (for cmp (eq ne)
-  (simplify
--  (cmp (max @0 @1) integer_zerop@2)
-+  (cmp (max @0 @1) integer_zerop)
-   (if (TYPE_UNSIGNED (TREE_TYPE (@0)))
--   (cmp (bit_ior @0 @1) @2))))
-+   (with { tree utype = unsigned_type_for (TREE_TYPE (@0)); }
-+    (cmp (bit_ior (convert:utype @0) (convert:utype @1))
-+         { build_zero_cst (utype); } )))))
- 
- /* Undo fancy ways of writing max/min or other ?: expressions, like
-    a - ((a - b) & -(a < b))  and  a - (a - b) * (a < b) into (a < b) ? b : a.
-diff --git a/gcc/testsuite/gcc.dg/torture/minmaxneeqptr-1.c b/gcc/testsuite/gcc.dg/torture/minmaxneeqptr-1.c
-new file mode 100644
-index 000000000000..aa45722330f4
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/torture/minmaxneeqptr-1.c
-@@ -0,0 +1,21 @@
-+/* { dg-do compile } */
-+
-+/* PR tree-optimization/117646 */
-+
-+int maxeq(char *a, char *b) {
-+  char *p = a < b ? b : a;
-+  return p == (void*)0;
-+}
-+int maxne(char *a, char *b) {
-+  char *p = a < b ? b : a;
-+  return p == (void*)0;
-+}
-+
-+int mineq(char *a, char *b) {
-+  char *p = a > b ? b : a;
-+  return p == (void*)0;
-+}
-+int minne(char *a, char *b) {
-+  char *p = a > b ? b : a;
-+  return p == (void*)0;
-+}
--- 
-2.47.0
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index df484a6..a17533c 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+??
+
+	- 73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch
+
 26	18 November 2024
 
 	+ 73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-18 17:25 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-18 17:25 UTC (permalink / raw
  To: gentoo-commits

commit:     aa56b526fa7d8766f57a7f24bedde612b00c197d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 18 17:24:23 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 18 17:24:51 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=aa56b526

15.0.0: drop 72_all_PR117628-libgcc-c23.patch

Jeff's pushed another patch which includes these bits (and more).

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

 15.0.0/gentoo/72_all_PR117628-libgcc-c23.patch | 71 --------------------------
 15.0.0/gentoo/README.history                   |  1 +
 2 files changed, 1 insertion(+), 71 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR117628-libgcc-c23.patch b/15.0.0/gentoo/72_all_PR117628-libgcc-c23.patch
deleted file mode 100644
index ddfb652..0000000
--- a/15.0.0/gentoo/72_all_PR117628-libgcc-c23.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From b750323260c1ceb47c64e98ddab7095696b00a6d Mon Sep 17 00:00:00 2001
-Message-ID: <b750323260c1ceb47c64e98ddab7095696b00a6d.1731921825.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Mon, 18 Nov 2024 09:22:33 +0000
-Subject: [PATCH] libgcc: fix C23 issues
-
-This includes Jeff's patch from https://inbox.sourceware.org/gcc-patches/9cb69002-9754-476a-a525-68dcca9c23d8@gmail.com/.
-
-Bug: https://gcc.gnu.org/PR117628
---- a/libgcc/config/arm/linux-atomic-64bit.c
-+++ b/libgcc/config/arm/linux-atomic-64bit.c
-@@ -141,9 +141,7 @@ __sync_val_compare_and_swap_8 (long long *ptr, long long oldval,
-     }
- }
- 
--typedef unsigned char bool;
--
--bool HIDDEN
-+unsigned char HIDDEN
- __sync_bool_compare_and_swap_8 (long long *ptr, long long oldval,
- 				 long long newval)
- {
---- a/libgcc/config/arm/linux-atomic.c
-+++ b/libgcc/config/arm/linux-atomic.c
-@@ -249,9 +249,7 @@ __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
- SUBWORD_VAL_CAS (short,       2)
- SUBWORD_VAL_CAS (signed char, 1)
- 
--typedef unsigned char bool;
--
--bool HIDDEN
-+unsigned char HIDDEN
- __sync_bool_compare_and_swap_4 (int *ptr, int oldval, int newval)
- {
-   int failure = __kernel_cmpxchg (oldval, newval, ptr);
-@@ -259,7 +257,7 @@ __sync_bool_compare_and_swap_4 (int *ptr, int oldval, int newval)
- }
- 
- #define SUBWORD_BOOL_CAS(TYPE, WIDTH)					\
--  bool HIDDEN								\
-+  unsigned char HIDDEN								\
-   __sync_bool_compare_and_swap_##WIDTH (TYPE *ptr, TYPE oldval,		\
- 					TYPE newval)			\
-   {									\
---- a/libgcc/config/csky/linux-atomic.c
-+++ b/libgcc/config/csky/linux-atomic.c
-@@ -215,8 +215,6 @@ __sync_val_compare_and_swap_4 (int *ptr, int oldval, int newval)
- SUBWORD_VAL_CAS (unsigned short, 2)
- SUBWORD_VAL_CAS (unsigned char,	1)
- 
--typedef unsigned char bool;
--
- bool HIDDEN
- __sync_bool_compare_and_swap_4 (int *ptr, int oldval, int newval)
- {
---- a/libgcc/unwind-arm-common.inc
-+++ b/libgcc/unwind-arm-common.inc
-@@ -52,8 +52,6 @@
- 
- /* Definitions for C++ runtime support routines.  We make these weak
-    declarations to avoid pulling in libsupc++ unnecessarily.  */
--typedef unsigned char bool;
--
- typedef struct _ZSt9type_info type_info; /* This names C++ type_info type */
- enum __cxa_type_match_result
-   {
-
-base-commit: 45a3277149d95a51cf9109cab87ee39a7dce73e2
--- 
-2.47.0
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index a17533c..479b5cc 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,5 +1,6 @@
 ??
 
+	- 72_all_PR117628-libgcc-c23.patch
 	- 73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch
 
 26	18 November 2024


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-24 22:42 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-24 22:42 UTC (permalink / raw
  To: gentoo-commits

commit:     37dff17dbf53946cffea53f5c0514f229f3be11d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 24 22:41:57 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov 24 22:41:57 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=37dff17d

15.0.0: add 34_all_time64_ssemath.patch like for 14.2.0

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

 15.0.0/gentoo/34_all_time64_ssemath.patch | 43 +++++++++++++++++++++++++++++++
 15.0.0/gentoo/README.history              |  1 +
 2 files changed, 44 insertions(+)

diff --git a/15.0.0/gentoo/34_all_time64_ssemath.patch b/15.0.0/gentoo/34_all_time64_ssemath.patch
new file mode 100644
index 0000000..3701b6b
--- /dev/null
+++ b/15.0.0/gentoo/34_all_time64_ssemath.patch
@@ -0,0 +1,43 @@
+From 33ba5944f2b887fe8bddd541790645b74f1f2655 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sun, 24 Nov 2024 14:45:37 +0100
+Subject: [PATCH] Default to -mfpmath=sse on x86 with time64
+
+Our time64 stages already default to `-mfpmath=sse`, so let's have
+the time64 flag implicitly enable it as the default to make things more
+consistent.  Furthermore, this also improves compatibility with clang
+that always enables it whenever the target architectures supports SSE.
+
+Note that this works only if `-march=` with SSE support is specified.
+We could technically improve the consistency even further by raising
+the default `-march=`, but that seems a bit intrusive and probably
+unnecessary, given that the vast majority of Gentoo users and/or
+upstream projects will specify `-march=`.
+
+See also:
+https://public-inbox.gentoo.org/gentoo-dev/ce894afe6c2b324fef012da9bb9387cfde7aed03.camel@gentoo.org/
+https://public-inbox.gentoo.org/gentoo-dev/baa1ca92da4941b0999ea2feecf02334b5b20ade.camel@gentoo.org/
+---
+ gcc/config/i386/i386-options.cc | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
+index 6c212a8ed..03801f382 100644
+--- a/gcc/config/i386/i386-options.cc
++++ b/gcc/config/i386/i386-options.cc
+@@ -2881,7 +2881,11 @@ ix86_option_override_internal (bool main_args_p,
+      Also -mfpmath=387 is overall a lot more compact (bout 4-5%) than SSE
+      codegen.  We may switch to 387 with -ffast-math for size optimized
+      functions. */
+-  else if (fast_math_flags_set_p (&global_options)
++#ifndef _GENTOO_TIME64_FORCE
++  #define _GENTOO_TIME64_FORCE 0
++#endif
++
++  else if ((fast_math_flags_set_p (&global_options) || _GENTOO_TIME64_FORCE)
+ 	   && TARGET_SSE2_P (opts->x_ix86_isa_flags))
+     opts->x_ix86_fpmath = FPMATH_SSE;
+   else
+-- 
+2.47.0
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 479b5cc..cf197b9 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,5 +1,6 @@
 ??
 
+	+ 34_all_time64_ssemath.patch
 	- 72_all_PR117628-libgcc-c23.patch
 	- 73_all_PR117646-match-Fix-the-max-a-b-0-pattern-for-pointers.patch
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-25  3:00 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-25  3:00 UTC (permalink / raw
  To: gentoo-commits

commit:     ad1e08717f7b9831b6017cc6c256963c43c704d7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 25 02:59:15 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 25 02:59:53 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ad1e0871

15.0.0: add 72_all_PR111600-genemit-Distribute-evenly-to-files.patch

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

 ...111600-genemit-Distribute-evenly-to-files.patch | 194 +++++++++++++++++++++
 1 file changed, 194 insertions(+)

diff --git a/15.0.0/gentoo/72_all_PR111600-genemit-Distribute-evenly-to-files.patch b/15.0.0/gentoo/72_all_PR111600-genemit-Distribute-evenly-to-files.patch
new file mode 100644
index 0000000..287e082
--- /dev/null
+++ b/15.0.0/gentoo/72_all_PR111600-genemit-Distribute-evenly-to-files.patch
@@ -0,0 +1,194 @@
+https://inbox.sourceware.org/gcc-patches/D5S1TZK05IYW.2D2RLLK7L1ZQ1@gmail.com/
+
+From 359fea7741c6c8f98239aa32f5c3b6f4a582567b Mon Sep 17 00:00:00 2001
+Message-ID: <359fea7741c6c8f98239aa32f5c3b6f4a582567b.1732312478.git.sam@gentoo.org>
+From: Robin Dapp <rdapp.gcc@gmail.com>
+Date: Thu, 21 Nov 2024 18:56:32 +0100
+Subject: [PATCH] genemit: Distribute evenly to files [PR111600].
+
+Hi,
+
+currently we distribute insn patterns in genemit, partitioning them
+by the number of patterns per file.  The first 100 into file 1, the
+next 100 into file 2, and so on.  Depending on the patterns this
+can lead to files of very uneven size.
+
+Similar to the genmatch split, this patch introduces a dynamic
+choose_output () which considers the size of the output files
+and selects the shortest one for the next pattern.
+
+Bootstrapped and regtested on x86 and power10, aarch64 running.
+Regtested on rv64gcv.
+
+gcc/ChangeLog:
+
+	PR target/111600
+
+* genemit.cc (handle_arg): Use files instead of filenames.
+	(main): Ditto.
+	* gensupport.cc (SIZED_BASED_CHUNKS): Define.
+	(choose_output): New function.
+	* gensupport.h (choose_output): Declare.
+---
+ gcc/genemit.cc    | 53 ++++++++++++++---------------------------------
+ gcc/gensupport.cc | 33 +++++++++++++++++++++++++++++
+ gcc/gensupport.h  |  1 +
+ 3 files changed, 50 insertions(+), 37 deletions(-)
+
+diff --git a/gcc/genemit.cc b/gcc/genemit.cc
+index 5d3d10f5061a..518fb85ce8c8 100644
+--- a/gcc/genemit.cc
++++ b/gcc/genemit.cc
+@@ -905,14 +905,15 @@ from the machine description file `md'.  */\n\n");
+   fprintf (file, "#include \"target.h\"\n\n");
+ }
+ 
+-auto_vec<const char *, 10> output_files;
++auto_vec<FILE *, 10> output_files;
+ 
+ static bool
+ handle_arg (const char *arg)
+ {
+   if (arg[1] == 'O')
+     {
+-      output_files.safe_push (&arg[2]);
++      FILE *file = fopen (&arg[2], "w");
++      output_files.safe_push (file);
+       return true;
+     }
+   return false;
+@@ -933,47 +934,21 @@ main (int argc, const char **argv)
+   /* Assign sequential codes to all entries in the machine description
+      in parallel with the tables in insn-output.cc.  */
+ 
+-  int npatterns = count_patterns ();
+   md_rtx_info info;
+ 
+-  bool to_stdout = false;
+-  int npatterns_per_file = npatterns;
+-  if (!output_files.is_empty ())
+-    npatterns_per_file = npatterns / output_files.length () + 1;
+-  else
+-    to_stdout = true;
+-
+-  gcc_assert (npatterns_per_file > 1);
++  if (output_files.is_empty ())
++    output_files.safe_push (stdout);
+ 
+-  /* Reverse so we can pop the first-added element.  */
+-  output_files.reverse ();
++  for (auto f : output_files)
++    print_header (f);
+ 
+-  int count = 0;
+   FILE *file = NULL;
++  unsigned file_idx;
+ 
+   /* Read the machine description.  */
+   while (read_md_rtx (&info))
+     {
+-      if (count == 0 || count == npatterns_per_file)
+-	{
+-	  bool is_last = !to_stdout && output_files.is_empty ();
+-	  if (file && !is_last)
+-	    if (fclose (file) != 0)
+-	      return FATAL_EXIT_CODE;
+-
+-	  if (!output_files.is_empty ())
+-	    {
+-	      const char *const filename = output_files.pop ();
+-	      file = fopen (filename, "w");
+-	    }
+-	  else if (to_stdout)
+-	    file = stdout;
+-	  else
+-	    break;
+-
+-	  print_header (file);
+-	  count = 0;
+-	}
++      file = choose_output (output_files, file_idx);
+ 
+       switch (GET_CODE (info.def))
+ 	{
+@@ -999,10 +974,10 @@ main (int argc, const char **argv)
+ 	default:
+ 	  break;
+ 	}
+-
+-      count++;
+     }
+ 
++  file = choose_output (output_files, file_idx);
++
+   /* Write out the routines to add CLOBBERs to a pattern and say whether they
+      clobber a hard reg.  */
+   output_add_clobbers (&info, file);
+@@ -1015,5 +990,9 @@ main (int argc, const char **argv)
+       handle_overloaded_gen (oname, file);
+     }
+ 
+-  return (fclose (file) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
++  for (FILE *f : output_files)
++    if (fclose (f) != 0)
++      return FATAL_EXIT_CODE;
++
++  return SUCCESS_EXIT_CODE;
+ }
+diff --git a/gcc/gensupport.cc b/gcc/gensupport.cc
+index 3a02132c8761..e0adf0c1bc54 100644
+--- a/gcc/gensupport.cc
++++ b/gcc/gensupport.cc
+@@ -3913,3 +3913,36 @@ find_optab (optab_pattern *p, const char *name)
+     }
+   return false;
+ }
++
++/* Find the file to write into next.  We try to evenly distribute the contents
++   over the different files.  */
++
++#define SIZED_BASED_CHUNKS 1
++
++FILE *
++choose_output (const vec<FILE *> &parts, unsigned &idx)
++{
++  if (parts.length () == 0)
++    gcc_unreachable ();
++#ifdef SIZED_BASED_CHUNKS
++  FILE *shortest = NULL;
++  long min = 0;
++  idx = 0;
++  for (unsigned i = 0; i < parts.length (); i++)
++    {
++      FILE *part  = parts[i];
++      long len = ftell (part);
++      if (!shortest || min > len)
++	{
++	  shortest = part;
++	  min = len;
++	  idx = i;
++       }
++    }
++  return shortest;
++#else
++  static int current_file;
++  idx = current_file++ % parts.length ();
++  return parts[idx];
++#endif
++}
+diff --git a/gcc/gensupport.h b/gcc/gensupport.h
+index b7a1da34518c..781c9e9ffcea 100644
+--- a/gcc/gensupport.h
++++ b/gcc/gensupport.h
+@@ -231,5 +231,6 @@ extern file_location get_file_location (rtx);
+ extern const char *get_emit_function (rtx);
+ extern bool needs_barrier_p (rtx);
+ extern bool find_optab (optab_pattern *, const char *);
++extern FILE *choose_output (const vec<FILE *> &, unsigned &);
+ 
+ #endif /* GCC_GENSUPPORT_H */
+
+base-commit: 76c202329458aad027ececc59d666e4995e3644e
+-- 
+2.47.0
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-25  3:00 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-25  3:00 UTC (permalink / raw
  To: gentoo-commits

commit:     1bd66ae9f12542821d29d7692284389f5ffb4e51
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 24 22:42:41 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Nov 24 22:42:41 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=1bd66ae9

15.0.0: cut patchset 27

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index cf197b9..c8d1a49 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-??
+27	24 November 2024
 
 	+ 34_all_time64_ssemath.patch
 	- 72_all_PR117628-libgcc-c23.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-25  3:01 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-25  3:01 UTC (permalink / raw
  To: gentoo-commits

commit:     b42ad3974593603461104aacf942c53595108fa7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 25 03:01:43 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 25 03:01:43 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b42ad397

15.0.0: cut patchset 28

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

 15.0.0/gentoo/README.history | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index c8d1a49..7a89c63 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+28	25 November 2024
+
+	+ 72_all_PR111600-genemit-Distribute-evenly-to-files.patch
+
 27	24 November 2024
 
 	+ 34_all_time64_ssemath.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-25 15:10 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-25 15:10 UTC (permalink / raw
  To: gentoo-commits

commit:     12bd49fdb9c159ea05e498160adef179467bc729
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 25 15:09:49 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 25 15:09:49 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=12bd49fd

15.0.0: drop 72_all_PR111600-genemit-Distribute-evenly-to-files.patch

Now merged upstream.

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

 ...111600-genemit-Distribute-evenly-to-files.patch | 194 ---------------------
 15.0.0/gentoo/README.history                       |   4 +
 2 files changed, 4 insertions(+), 194 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR111600-genemit-Distribute-evenly-to-files.patch b/15.0.0/gentoo/72_all_PR111600-genemit-Distribute-evenly-to-files.patch
deleted file mode 100644
index 287e082..0000000
--- a/15.0.0/gentoo/72_all_PR111600-genemit-Distribute-evenly-to-files.patch
+++ /dev/null
@@ -1,194 +0,0 @@
-https://inbox.sourceware.org/gcc-patches/D5S1TZK05IYW.2D2RLLK7L1ZQ1@gmail.com/
-
-From 359fea7741c6c8f98239aa32f5c3b6f4a582567b Mon Sep 17 00:00:00 2001
-Message-ID: <359fea7741c6c8f98239aa32f5c3b6f4a582567b.1732312478.git.sam@gentoo.org>
-From: Robin Dapp <rdapp.gcc@gmail.com>
-Date: Thu, 21 Nov 2024 18:56:32 +0100
-Subject: [PATCH] genemit: Distribute evenly to files [PR111600].
-
-Hi,
-
-currently we distribute insn patterns in genemit, partitioning them
-by the number of patterns per file.  The first 100 into file 1, the
-next 100 into file 2, and so on.  Depending on the patterns this
-can lead to files of very uneven size.
-
-Similar to the genmatch split, this patch introduces a dynamic
-choose_output () which considers the size of the output files
-and selects the shortest one for the next pattern.
-
-Bootstrapped and regtested on x86 and power10, aarch64 running.
-Regtested on rv64gcv.
-
-gcc/ChangeLog:
-
-	PR target/111600
-
-* genemit.cc (handle_arg): Use files instead of filenames.
-	(main): Ditto.
-	* gensupport.cc (SIZED_BASED_CHUNKS): Define.
-	(choose_output): New function.
-	* gensupport.h (choose_output): Declare.
----
- gcc/genemit.cc    | 53 ++++++++++++++---------------------------------
- gcc/gensupport.cc | 33 +++++++++++++++++++++++++++++
- gcc/gensupport.h  |  1 +
- 3 files changed, 50 insertions(+), 37 deletions(-)
-
-diff --git a/gcc/genemit.cc b/gcc/genemit.cc
-index 5d3d10f5061a..518fb85ce8c8 100644
---- a/gcc/genemit.cc
-+++ b/gcc/genemit.cc
-@@ -905,14 +905,15 @@ from the machine description file `md'.  */\n\n");
-   fprintf (file, "#include \"target.h\"\n\n");
- }
- 
--auto_vec<const char *, 10> output_files;
-+auto_vec<FILE *, 10> output_files;
- 
- static bool
- handle_arg (const char *arg)
- {
-   if (arg[1] == 'O')
-     {
--      output_files.safe_push (&arg[2]);
-+      FILE *file = fopen (&arg[2], "w");
-+      output_files.safe_push (file);
-       return true;
-     }
-   return false;
-@@ -933,47 +934,21 @@ main (int argc, const char **argv)
-   /* Assign sequential codes to all entries in the machine description
-      in parallel with the tables in insn-output.cc.  */
- 
--  int npatterns = count_patterns ();
-   md_rtx_info info;
- 
--  bool to_stdout = false;
--  int npatterns_per_file = npatterns;
--  if (!output_files.is_empty ())
--    npatterns_per_file = npatterns / output_files.length () + 1;
--  else
--    to_stdout = true;
--
--  gcc_assert (npatterns_per_file > 1);
-+  if (output_files.is_empty ())
-+    output_files.safe_push (stdout);
- 
--  /* Reverse so we can pop the first-added element.  */
--  output_files.reverse ();
-+  for (auto f : output_files)
-+    print_header (f);
- 
--  int count = 0;
-   FILE *file = NULL;
-+  unsigned file_idx;
- 
-   /* Read the machine description.  */
-   while (read_md_rtx (&info))
-     {
--      if (count == 0 || count == npatterns_per_file)
--	{
--	  bool is_last = !to_stdout && output_files.is_empty ();
--	  if (file && !is_last)
--	    if (fclose (file) != 0)
--	      return FATAL_EXIT_CODE;
--
--	  if (!output_files.is_empty ())
--	    {
--	      const char *const filename = output_files.pop ();
--	      file = fopen (filename, "w");
--	    }
--	  else if (to_stdout)
--	    file = stdout;
--	  else
--	    break;
--
--	  print_header (file);
--	  count = 0;
--	}
-+      file = choose_output (output_files, file_idx);
- 
-       switch (GET_CODE (info.def))
- 	{
-@@ -999,10 +974,10 @@ main (int argc, const char **argv)
- 	default:
- 	  break;
- 	}
--
--      count++;
-     }
- 
-+  file = choose_output (output_files, file_idx);
-+
-   /* Write out the routines to add CLOBBERs to a pattern and say whether they
-      clobber a hard reg.  */
-   output_add_clobbers (&info, file);
-@@ -1015,5 +990,9 @@ main (int argc, const char **argv)
-       handle_overloaded_gen (oname, file);
-     }
- 
--  return (fclose (file) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
-+  for (FILE *f : output_files)
-+    if (fclose (f) != 0)
-+      return FATAL_EXIT_CODE;
-+
-+  return SUCCESS_EXIT_CODE;
- }
-diff --git a/gcc/gensupport.cc b/gcc/gensupport.cc
-index 3a02132c8761..e0adf0c1bc54 100644
---- a/gcc/gensupport.cc
-+++ b/gcc/gensupport.cc
-@@ -3913,3 +3913,36 @@ find_optab (optab_pattern *p, const char *name)
-     }
-   return false;
- }
-+
-+/* Find the file to write into next.  We try to evenly distribute the contents
-+   over the different files.  */
-+
-+#define SIZED_BASED_CHUNKS 1
-+
-+FILE *
-+choose_output (const vec<FILE *> &parts, unsigned &idx)
-+{
-+  if (parts.length () == 0)
-+    gcc_unreachable ();
-+#ifdef SIZED_BASED_CHUNKS
-+  FILE *shortest = NULL;
-+  long min = 0;
-+  idx = 0;
-+  for (unsigned i = 0; i < parts.length (); i++)
-+    {
-+      FILE *part  = parts[i];
-+      long len = ftell (part);
-+      if (!shortest || min > len)
-+	{
-+	  shortest = part;
-+	  min = len;
-+	  idx = i;
-+       }
-+    }
-+  return shortest;
-+#else
-+  static int current_file;
-+  idx = current_file++ % parts.length ();
-+  return parts[idx];
-+#endif
-+}
-diff --git a/gcc/gensupport.h b/gcc/gensupport.h
-index b7a1da34518c..781c9e9ffcea 100644
---- a/gcc/gensupport.h
-+++ b/gcc/gensupport.h
-@@ -231,5 +231,6 @@ extern file_location get_file_location (rtx);
- extern const char *get_emit_function (rtx);
- extern bool needs_barrier_p (rtx);
- extern bool find_optab (optab_pattern *, const char *);
-+extern FILE *choose_output (const vec<FILE *> &, unsigned &);
- 
- #endif /* GCC_GENSUPPORT_H */
-
-base-commit: 76c202329458aad027ececc59d666e4995e3644e
--- 
-2.47.0
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 7a89c63..926d4de 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+??
+
+	- 72_all_PR111600-genemit-Distribute-evenly-to-files.patch
+
 28	25 November 2024
 
 	+ 72_all_PR111600-genemit-Distribute-evenly-to-files.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-27 17:42 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-27 17:42 UTC (permalink / raw
  To: gentoo-commits

commit:     ee2008a6cbb19d604b2cfa4e9c1eeb08e2488cf0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 27 17:42:31 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 27 17:42:31 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ee2008a6

15.0.0: pull in genrecog split patch

I will see about backporting these (downstream) once they're all merged,
at least to 14.

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

 ...0-genrecog-Split-into-separate-partitions.patch | 1369 ++++++++++++++++++++
 1 file changed, 1369 insertions(+)

diff --git a/15.0.0/gentoo/72_all_PR111600-genrecog-Split-into-separate-partitions.patch b/15.0.0/gentoo/72_all_PR111600-genrecog-Split-into-separate-partitions.patch
new file mode 100644
index 0000000..07486e4
--- /dev/null
+++ b/15.0.0/gentoo/72_all_PR111600-genrecog-Split-into-separate-partitions.patch
@@ -0,0 +1,1369 @@
+From 1135970eb38c8f90db20c12cb4222e3a5214557e Mon Sep 17 00:00:00 2001
+Message-ID: <1135970eb38c8f90db20c12cb4222e3a5214557e.1732630692.git.sam@gentoo.org>
+From: Robin Dapp <rdapp.gcc@gmail.com>
+Date: Tue, 26 Nov 2024 14:44:17 +0100
+Subject: [PATCH] genrecog: Split into separate partitions [PR111600].
+
+Hi,
+
+this patch makes genrecog split its output into separate files (10 by
+default) in the same vein genemit does.  The changes are mostly
+mechanical again, changing printfs and puts to fprintf.
+As insn-recog.cc relies on being able to call other recog functions a
+header insn-recog.h is introduced that pre declares all of those.
+
+For simplicity the number of files is determined by (re-using)
+--with-insnemit-partitions.  Naming suggestions welcome :)
+
+Bootstrapped and regtested on x86 and power10, regtested on riscv.
+aarch64 bootstrap is currently blocked because of the
+"maybe uninitialized" issue discussed on IRC.
+
+Regards
+ Robin
+
+gcc/ChangeLog:
+
+* Makefile.in:  Add insn-recog split.
+	* configure.ac: Document that the number of insnemit partitions is
+	used for insn-recog as well.
+	* genconditions.cc (write_one_condition): Use fprintf.
+	* genpreds.cc (write_predicate_expr): Ditto.
+	(write_init_reg_class_start_regs): Ditto.
+	* genrecog.cc (write_header): Add header file to includes.
+	(printf_indent): Use fprintf.
+	(change_state): Ditto.
+	(print_code): Ditto.
+	(print_host_wide_int): Ditto.
+	(print_parameter_value): Ditto.
+	(print_test_rtx): Ditto.
+	(print_nonbool_test): Ditto.
+	(print_label_value): Ditto.
+	(print_test): Ditto.
+	(print_decision): Ditto.
+	(print_state): Ditto.
+	(print_subroutine_call): Ditto.
+	(print_acceptance): Ditto.
+	(print_subroutine_start): Ditto.
+	(print_pattern): Ditto.
+	(print_subroutine): Ditto.
+	(print_subroutine_group): Ditto.
+	(handle_arg): Add -O and -H for output and header file handling.
+	(main): Use callback.
+	* gentarget-def.cc (def_target_insn): Use fprintf.
+	* read-md.cc (md_reader::print_c_condition): Ditto.
+	* read-md.h (class md_reader): Ditto.
+---
+ gcc/Makefile.in      |  29 ++-
+ gcc/configure.ac     |   4 +-
+ gcc/genconditions.cc |   4 +-
+ gcc/genpreds.cc      |   4 +-
+ gcc/genrecog.cc      | 552 +++++++++++++++++++++++++------------------
+ gcc/gentarget-def.cc |   2 +-
+ gcc/read-md.cc       |   4 +-
+ gcc/read-md.h        |   2 +-
+ 8 files changed, 358 insertions(+), 243 deletions(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index ead8d2eb094c..d301bef47003 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -239,6 +239,12 @@ INSNEMIT_SEQ_SRC = $(patsubst %, insn-emit-%.cc, $(INSNEMIT_SPLITS_SEQ))
+ INSNEMIT_SEQ_TMP = $(patsubst %, tmp-emit-%.cc, $(INSNEMIT_SPLITS_SEQ))
+ INSNEMIT_SEQ_O = $(patsubst %, insn-emit-%.o, $(INSNEMIT_SPLITS_SEQ))
+ 
++# Re-use the split number for insn-recog as well.
++INSNRECOG_SPLITS_SEQ = $(wordlist 1,$(NUM_INSNEMIT_SPLITS),$(one_to_9999))
++INSNRECOG_SEQ_SRC = $(patsubst %, insn-recog-%.cc, $(INSNRECOG_SPLITS_SEQ))
++INSNRECOG_SEQ_TMP = $(patsubst %, tmp-recog-%.cc, $(INSNRECOG_SPLITS_SEQ))
++INSNRECOG_SEQ_O = $(patsubst %, insn-recog-%.o, $(INSNRECOG_SPLITS_SEQ))
++
+ # These files are to have specific diagnostics suppressed, or are not to
+ # be subject to -Werror:
+ # flex output may yield harmless "no previous prototype" warnings
+@@ -1385,7 +1391,7 @@ OBJS = \
+ 	insn-output.o \
+ 	insn-peep.o \
+ 	insn-preds.o \
+-	insn-recog.o \
++	$(INSNRECOG_SEQ_O) \
+ 	insn-enums.o \
+ 	ggc-page.o \
+ 	adjust-alignment.o \
+@@ -1903,8 +1909,8 @@ TREECHECKING = @TREECHECKING@
+ FULL_DRIVER_NAME=$(target_noncanonical)-gcc-$(version)$(exeext)
+ 
+ MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
+- insn-output.cc insn-recog.cc $(INSNEMIT_SEQ_SRC) \
+- insn-extract.cc insn-peep.cc \
++ insn-output.cc $(INSNRECOG_SEQ_SRC) insn-recog.h \
++ $(INSNEMIT_SEQ_SRC) insn-extract.cc insn-peep.cc \
+  insn-attr.h insn-attr-common.h insn-attrtab.cc insn-dfatab.cc \
+  insn-latencytab.cc insn-opinit.cc insn-opinit.h insn-preds.cc insn-constants.h \
+  tm-preds.h tm-constrs.h checksum-options $(GIMPLE_MATCH_PD_SEQ_SRC) \
+@@ -2671,7 +2677,8 @@ $(common_out_object_file): $(common_out_file)
+ # and compile them.
+ 
+ .PRECIOUS: insn-config.h insn-flags.h insn-codes.h insn-constants.h \
+-  $(INSNEMIT_SEQ_SRC) insn-recog.cc insn-extract.cc insn-output.cc \
++  $(INSNEMIT_SEQ_SRC) insn-recog.h $(INSNRECOG_SEQ_SRC) \
++  insn-extract.cc insn-output.cc \
+   insn-peep.cc insn-attr.h insn-attr-common.h insn-attrtab.cc \
+   insn-dfatab.cc insn-latencytab.cc insn-preds.cc \
+   $(GIMPLE_MATCH_PD_SEQ_SRC) $(GENERIC_MATCH_PD_SEQ_SRC) \
+@@ -2700,7 +2707,7 @@ simple_rtl_generated_h	= insn-attr.h insn-attr-common.h insn-codes.h \
+ 
+ simple_rtl_generated_c	= insn-automata.cc \
+ 			  insn-extract.cc insn-output.cc \
+-			  insn-peep.cc insn-recog.cc
++			  insn-peep.cc
+ 
+ simple_generated_h	= $(simple_rtl_generated_h) insn-constants.h
+ 
+@@ -2738,6 +2745,18 @@ s-tmp-emit: build/genemit$(build_exeext) $(MD_DEPS) insn-conditions.md
+ 	  insn-emit-$(id).cc;)
+ 	$(STAMP) s-tmp-emit
+ 
++# Same for genrecog.
++$(INSNRECOG_SEQ_SRC): s-tmp-recog; @true
++insn-recog.h: s-tmp-recog; @true
++s-tmp-recog: build/genrecog$(build_exeext) $(MD_DEPS) insn-conditions.md
++	$(RUN_GEN) build/genrecog$(build_exeext) $(md_file) insn-conditions.md \
++	  -Hinsn-recog.h \
++	  $(addprefix -O,${INSNRECOG_SEQ_TMP})
++	$(foreach id, $(INSNRECOG_SPLITS_SEQ), \
++	  $(SHELL) $(srcdir)/../move-if-change tmp-recog-$(id).cc \
++	  insn-recog-$(id).cc;)
++	$(STAMP) s-tmp-recog
++
+ # gencheck doesn't read the machine description, and the file produced
+ # doesn't use the insn-* convention.
+ 
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index c546432b2775..a0d9038ea595 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -913,10 +913,10 @@ fi
+ 
+ AC_SUBST(DEFAULT_MATCHPD_PARTITIONS)
+ 
+-# Specify the number of splits of insn-emit.cc to generate.
++# Specify the number of splits of insn-emit.cc and insn-recog.cc to generate.
+ AC_ARG_WITH(insnemit-partitions,
+ [AS_HELP_STRING([--with-insnemit-partitions=num],
+-[Set the number of partitions of insn-emit.cc for genemit to create. [default=10]])],
++[Set the number of partitions of insn-emit.cc for genemit and genrecog to create. [default=10]])],
+ [DEFAULT_INSNEMIT_PARTITIONS="$with_insnemit_partitions"], [DEFAULT_INSNEMIT_PARTITIONS=10])
+ if (test $DEFAULT_INSNEMIT_PARTITIONS -lt 1); then
+   AC_MSG_ERROR(m4_normalize([
+diff --git a/gcc/genconditions.cc b/gcc/genconditions.cc
+index 13963dc3ff46..9da460893d52 100644
+--- a/gcc/genconditions.cc
++++ b/gcc/genconditions.cc
+@@ -141,9 +141,9 @@ write_one_condition (void **slot, void * ARG_UNUSED (dummy))
+     }
+ 
+   fputs ("\",\n    __builtin_constant_p ", stdout);
+-  rtx_reader_ptr->print_c_condition (test->expr);
++  rtx_reader_ptr->print_c_condition (stdout, test->expr);
+   fputs ("\n    ? (int) ", stdout);
+-  rtx_reader_ptr->print_c_condition (test->expr);
++  rtx_reader_ptr->print_c_condition (stdout, test->expr);
+   fputs ("\n    : -1 },\n", stdout);
+   return 1;
+ }
+diff --git a/gcc/genpreds.cc b/gcc/genpreds.cc
+index 55d149e8a404..b8f3bf279d97 100644
+--- a/gcc/genpreds.cc
++++ b/gcc/genpreds.cc
+@@ -538,7 +538,7 @@ write_predicate_expr (rtx exp)
+       break;
+ 
+     case MATCH_TEST:
+-      rtx_reader_ptr->print_c_condition (XSTR (exp, 0));
++      rtx_reader_ptr->print_c_condition (stdout, XSTR (exp, 0));
+       break;
+ 
+     default:
+@@ -1344,7 +1344,7 @@ write_init_reg_class_start_regs ()
+       for (unsigned int i = 0; i < register_filters.length (); ++i)
+ 	{
+ 	  printf ("      if (");
+-	  rtx_reader_ptr->print_c_condition (register_filters[i]);
++	  rtx_reader_ptr->print_c_condition (stdout, register_filters[i]);
+ 	  printf (")\n"
+ 		  "        SET_HARD_REG_BIT (%s[%d], regno);\n",
+ 		  "this_target_constraints->register_filters", i);
+diff --git a/gcc/genrecog.cc b/gcc/genrecog.cc
+index ba09ec3b6005..7f7ca728bbe0 100644
+--- a/gcc/genrecog.cc
++++ b/gcc/genrecog.cc
+@@ -4255,9 +4255,9 @@ match_pattern (state *s, md_rtx_info *info, rtx pattern,
+ /* Begin the output file.  */
+ 
+ static void
+-write_header (void)
++write_header (FILE *f, const char *header_filename)
+ {
+-  puts ("\
++  fprintf (f, "%s", "\
+ /* Generated automatically by the program `genrecog' from the target\n\
+    machine description file.  */\n\
+ \n\
+@@ -4281,10 +4281,12 @@ write_header (void)
+ #include \"diagnostic-core.h\"\n\
+ #include \"reload.h\"\n\
+ #include \"regs.h\"\n\
+-#include \"tm-constrs.h\"\n\
+-\n");
++#include \"tm-constrs.h\"\n");
+ 
+-  puts ("\n\
++  fprintf (f, "#include \"%s\"\n", header_filename);
++  fprintf (f, "%s", "\n");
++
++  fprintf (f, "%s", "\n\
+ /* `recog' contains a decision tree that recognizes whether the rtx\n\
+    X0 is a valid instruction.\n\
+ \n\
+@@ -4293,19 +4295,19 @@ write_header (void)
+    pattern that matched.  This is the same as the order in the machine\n\
+    description of the entry that matched.  This number can be used as an\n\
+    index into `insn_data' and other tables.\n");
+-  puts ("\
++  fprintf (f, "%s", "\
+    The third parameter to recog is an optional pointer to an int.  If\n\
+    present, recog will accept a pattern if it matches except for missing\n\
+    CLOBBER expressions at the end.  In that case, the value pointed to by\n\
+    the optional pointer will be set to the number of CLOBBERs that need\n\
+    to be added (it should be initialized to zero by the caller).  If it");
+-  puts ("\
++  fprintf (f, "%s", "\
+    is set nonzero, the caller should allocate a PARALLEL of the\n\
+    appropriate size, copy the initial entries, and call add_clobbers\n\
+    (found in insn-emit.cc) to fill in the CLOBBERs.\n\
+ ");
+ 
+-  puts ("\n\
++  fprintf (f, "%s", "\n\
+    The function split_insns returns 0 if the rtl could not\n\
+    be split or the split rtl as an INSN list if it can be.\n\
+ \n\
+@@ -4463,13 +4465,13 @@ test_position_available_p (output_state *os, const rtx_test &test)
+ 
+ /* Like printf, but print INDENT spaces at the beginning.  */
+ 
+-static void ATTRIBUTE_PRINTF_2
+-printf_indent (unsigned int indent, const char *format, ...)
++static void ATTRIBUTE_PRINTF_3
++printf_indent (FILE *f, unsigned int indent, const char *format, ...)
+ {
+   va_list ap;
+   va_start (ap, format);
+-  printf ("%*s", indent, "");
+-  vprintf (format, ap);
++  fprintf (f, "%*s", indent, "");
++  vfprintf (f, format, ap);
+   va_end (ap);
+ }
+ 
+@@ -4478,7 +4480,7 @@ printf_indent (unsigned int indent, const char *format, ...)
+    OS with the new state.  */
+ 
+ static void
+-change_state (output_state *os, position *pos, unsigned int indent)
++change_state (FILE *f, output_state *os, position *pos, unsigned int indent)
+ {
+   unsigned int var = os->id_to_var[pos->id];
+   gcc_assert (var < os->var_to_id.length () && os->var_to_id[var] == pos->id);
+@@ -4487,19 +4489,19 @@ change_state (output_state *os, position *pos, unsigned int indent)
+   switch (pos->type)
+     {
+     case POS_PEEP2_INSN:
+-      printf_indent (indent, "x%d = PATTERN (peep2_next_insn (%d));\n",
++      printf_indent (f, indent, "x%d = PATTERN (peep2_next_insn (%d));\n",
+ 		     var, pos->arg);
+       break;
+ 
+     case POS_XEXP:
+-      change_state (os, pos->base, indent);
+-      printf_indent (indent, "x%d = XEXP (x%d, %d);\n",
++      change_state (f, os, pos->base, indent);
++      printf_indent (f, indent, "x%d = XEXP (x%d, %d);\n",
+ 		     var, os->id_to_var[pos->base->id], pos->arg);
+       break;
+ 
+     case POS_XVECEXP0:
+-      change_state (os, pos->base, indent);
+-      printf_indent (indent, "x%d = XVECEXP (x%d, 0, %d);\n",
++      change_state (f, os, pos->base, indent);
++      printf_indent (f, indent, "x%d = XVECEXP (x%d, 0, %d);\n",
+ 		     var, os->id_to_var[pos->base->id], pos->arg);
+       break;
+     }
+@@ -4510,11 +4512,11 @@ change_state (output_state *os, position *pos, unsigned int indent)
+    the name.  */
+ 
+ static void
+-print_code (enum rtx_code code)
++print_code (FILE *f, enum rtx_code code)
+ {
+   const char *p;
+   for (p = GET_RTX_NAME (code); *p; p++)
+-    putchar (TOUPPER (*p));
++    fprintf (f, "%c", TOUPPER (*p));
+ }
+ 
+ /* Emit a uint64_t as an integer constant expression.  We need to take
+@@ -4522,22 +4524,22 @@ print_code (enum rtx_code code)
+    warnings in the resulting code.  */
+ 
+ static void
+-print_host_wide_int (uint64_t val)
++print_host_wide_int (FILE *f, uint64_t val)
+ {
+   uint64_t min = uint64_t (1) << (HOST_BITS_PER_WIDE_INT - 1);
+   if (val == min)
+-    printf ("(" HOST_WIDE_INT_PRINT_DEC_C " - 1)", val + 1);
++    fprintf (f, "(" HOST_WIDE_INT_PRINT_DEC_C " - 1)", val + 1);
+   else
+-    printf (HOST_WIDE_INT_PRINT_DEC_C, val);
++    fprintf (f, HOST_WIDE_INT_PRINT_DEC_C, val);
+ }
+ 
+ /* Print the C expression for actual parameter PARAM.  */
+ 
+ static void
+-print_parameter_value (const parameter &param)
++print_parameter_value (FILE *f, const parameter &param)
+ {
+   if (param.is_param)
+-    printf ("i%d", (int) param.value + 1);
++    fprintf (f, "i%d", (int) param.value + 1);
+   else
+     switch (param.type)
+       {
+@@ -4546,23 +4548,23 @@ print_parameter_value (const parameter &param)
+ 	break;
+ 
+       case parameter::CODE:
+-	print_code ((enum rtx_code) param.value);
++	print_code (f, (enum rtx_code) param.value);
+ 	break;
+ 
+       case parameter::MODE:
+-	printf ("E_%smode", GET_MODE_NAME ((machine_mode) param.value));
++	fprintf (f, "E_%smode", GET_MODE_NAME ((machine_mode) param.value));
+ 	break;
+ 
+       case parameter::INT:
+-	printf ("%d", (int) param.value);
++	fprintf (f, "%d", (int) param.value);
+ 	break;
+ 
+       case parameter::UINT:
+-	printf ("%u", (unsigned int) param.value);
++	fprintf (f, "%u", (unsigned int) param.value);
+ 	break;
+ 
+       case parameter::WIDE_INT:
+-	print_host_wide_int (param.value);
++	print_host_wide_int (f, param.value);
+ 	break;
+       }
+ }
+@@ -4570,90 +4572,90 @@ print_parameter_value (const parameter &param)
+ /* Print the C expression for the rtx tested by TEST.  */
+ 
+ static void
+-print_test_rtx (output_state *os, const rtx_test &test)
++print_test_rtx (FILE *f, output_state *os, const rtx_test &test)
+ {
+   if (test.pos_operand >= 0)
+-    printf ("operands[%d]", test.pos_operand);
++    fprintf (f, "operands[%d]", test.pos_operand);
+   else
+-    printf ("x%d", os->id_to_var[test.pos->id]);
++    fprintf (f, "x%d", os->id_to_var[test.pos->id]);
+ }
+ 
+ /* Print the C expression for non-boolean test TEST.  */
+ 
+ static void
+-print_nonbool_test (output_state *os, const rtx_test &test)
++print_nonbool_test (FILE *f, output_state *os, const rtx_test &test)
+ {
+   switch (test.kind)
+     {
+     case rtx_test::CODE:
+-      printf ("GET_CODE (");
+-      print_test_rtx (os, test);
+-      printf (")");
++      fprintf (f, "GET_CODE (");
++      print_test_rtx (f, os, test);
++      fprintf (f, ")");
+       break;
+ 
+     case rtx_test::MODE:
+-      printf ("GET_MODE (");
+-      print_test_rtx (os, test);
+-      printf (")");
++      fprintf (f, "GET_MODE (");
++      print_test_rtx (f, os, test);
++      fprintf (f, ")");
+       break;
+ 
+     case rtx_test::VECLEN:
+-      printf ("XVECLEN (");
+-      print_test_rtx (os, test);
+-      printf (", 0)");
++      fprintf (f, "XVECLEN (");
++      print_test_rtx (f, os, test);
++      fprintf (f, ", 0)");
+       break;
+ 
+     case rtx_test::INT_FIELD:
+-      printf ("XINT (");
+-      print_test_rtx (os, test);
+-      printf (", %d)", test.u.opno);
++      fprintf (f, "XINT (");
++      print_test_rtx (f, os, test);
++      fprintf (f, ", %d)", test.u.opno);
+       break;
+ 
+     case rtx_test::REGNO_FIELD:
+-      printf ("REGNO (");
+-      print_test_rtx (os, test);
+-      printf (")");
++      fprintf (f, "REGNO (");
++      print_test_rtx (f, os, test);
++      fprintf (f, ")");
+       break;
+ 
+     case rtx_test::SUBREG_FIELD:
+-      printf ("SUBREG_BYTE (");
+-      print_test_rtx (os, test);
+-      printf (")");
++      fprintf (f, "SUBREG_BYTE (");
++      print_test_rtx (f, os, test);
++      fprintf (f, ")");
+       break;
+ 
+     case rtx_test::WIDE_INT_FIELD:
+-      printf ("XWINT (");
+-      print_test_rtx (os, test);
+-      printf (", %d)", test.u.opno);
++      fprintf (f, "XWINT (");
++      print_test_rtx (f, os, test);
++      fprintf (f, ", %d)", test.u.opno);
+       break;
+ 
+     case rtx_test::PATTERN:
+       {
+ 	pattern_routine *routine = test.u.pattern->routine;
+-	printf ("pattern%d (", routine->pattern_id);
++	fprintf (f, "pattern%d (", routine->pattern_id);
+ 	const char *sep = "";
+ 	if (test.pos)
+ 	  {
+-	    print_test_rtx (os, test);
++	    print_test_rtx (f, os, test);
+ 	    sep = ", ";
+ 	  }
+ 	if (routine->insn_p)
+ 	  {
+-	    printf ("%sinsn", sep);
++	    fprintf (f, "%sinsn", sep);
+ 	    sep = ", ";
+ 	  }
+ 	if (routine->pnum_clobbers_p)
+ 	  {
+-	    printf ("%spnum_clobbers", sep);
++	    fprintf (f, "%spnum_clobbers", sep);
+ 	    sep = ", ";
+ 	  }
+ 	for (unsigned int i = 0; i < test.u.pattern->params.length (); ++i)
+ 	  {
+-	    fputs (sep, stdout);
+-	    print_parameter_value (test.u.pattern->params[i]);
++	    fprintf (f, "%s\n", sep);
++	    print_parameter_value (f, test.u.pattern->params[i]);
+ 	    sep = ", ";
+ 	  }
+-	printf (")");
++	fprintf (f, ")");
+ 	break;
+       }
+ 
+@@ -4674,10 +4676,11 @@ print_nonbool_test (output_state *os, const rtx_test &test)
+    decision performs TEST.  Print the C code for the label.  */
+ 
+ static void
+-print_label_value (const rtx_test &test, bool is_param, uint64_t value)
++print_label_value (FILE *f, const rtx_test &test, bool is_param,
++		   uint64_t value)
+ {
+-  print_parameter_value (parameter (transition_parameter_type (test.kind),
+-				    is_param, value));
++  print_parameter_value (f, parameter (transition_parameter_type (test.kind),
++				       is_param, value));
+ }
+ 
+ /* If IS_PARAM, print code to compare TEST with the C variable i<VALUE+1>.
+@@ -4685,7 +4688,7 @@ print_label_value (const rtx_test &test, bool is_param, uint64_t value)
+    Test for inequality if INVERT_P, otherwise test for equality.  */
+ 
+ static void
+-print_test (output_state *os, const rtx_test &test, bool is_param,
++print_test (FILE *f, output_state *os, const rtx_test &test, bool is_param,
+ 	    uint64_t value, bool invert_p)
+ {
+   switch (test.kind)
+@@ -4698,71 +4701,71 @@ print_test (output_state *os, const rtx_test &test, bool is_param,
+     case rtx_test::INT_FIELD:
+     case rtx_test::WIDE_INT_FIELD:
+     case rtx_test::PATTERN:
+-      print_nonbool_test (os, test);
+-      printf (" %s ", invert_p ? "!=" : "==");
+-      print_label_value (test, is_param, value);
++      print_nonbool_test (f, os, test);
++      fprintf (f, " %s ", invert_p ? "!=" : "==");
++      print_label_value (f, test, is_param, value);
+       break;
+ 
+     case rtx_test::SUBREG_FIELD:
+-      printf ("%s (", invert_p ? "maybe_ne" : "known_eq");
+-      print_nonbool_test (os, test);
+-      printf (", ");
+-      print_label_value (test, is_param, value);
+-      printf (")");
++      fprintf (f, "%s (", invert_p ? "maybe_ne" : "known_eq");
++      print_nonbool_test (f, os, test);
++      fprintf (f, ", ");
++      print_label_value (f, test, is_param, value);
++      fprintf (f, ")");
+       break;
+ 
+     case rtx_test::SAVED_CONST_INT:
+       gcc_assert (!is_param && value == 1);
+-      print_test_rtx (os, test);
+-      printf (" %s const_int_rtx[MAX_SAVED_CONST_INT + ",
+-	      invert_p ? "!=" : "==");
+-      print_parameter_value (parameter (parameter::INT,
+-					test.u.integer.is_param,
+-					test.u.integer.value));
+-      printf ("]");
++      print_test_rtx (f, os, test);
++      fprintf (f, " %s const_int_rtx[MAX_SAVED_CONST_INT + ",
++	       invert_p ? "!=" : "==");
++      print_parameter_value (f, parameter (parameter::INT,
++					   test.u.integer.is_param,
++					   test.u.integer.value));
++      fprintf (f, "]");
+       break;
+ 
+     case rtx_test::PEEP2_COUNT:
+       gcc_assert (!is_param && value == 1);
+-      printf ("peep2_current_count %s %d", invert_p ? "<" : ">=",
+-	      test.u.min_len);
++      fprintf (f, "peep2_current_count %s %d", invert_p ? "<" : ">=",
++	       test.u.min_len);
+       break;
+ 
+     case rtx_test::VECLEN_GE:
+       gcc_assert (!is_param && value == 1);
+-      printf ("XVECLEN (");
+-      print_test_rtx (os, test);
+-      printf (", 0) %s %d", invert_p ? "<" : ">=", test.u.min_len);
++      fprintf (f, "XVECLEN (");
++      print_test_rtx (f, os, test);
++      fprintf (f, ", 0) %s %d", invert_p ? "<" : ">=", test.u.min_len);
+       break;
+ 
+     case rtx_test::PREDICATE:
+       gcc_assert (!is_param && value == 1);
+-      printf ("%s%s (", invert_p ? "!" : "", test.u.predicate.data->name);
+-      print_test_rtx (os, test);
+-      printf (", ");
+-      print_parameter_value (parameter (parameter::MODE,
+-					test.u.predicate.mode_is_param,
+-					test.u.predicate.mode));
+-      printf (")");
++      fprintf (f, "%s%s (", invert_p ? "!" : "", test.u.predicate.data->name);
++      print_test_rtx (f, os, test);
++      fprintf (f, ", ");
++      print_parameter_value (f, parameter (parameter::MODE,
++					   test.u.predicate.mode_is_param,
++					   test.u.predicate.mode));
++      fprintf (f, ")");
+       break;
+ 
+     case rtx_test::DUPLICATE:
+       gcc_assert (!is_param && value == 1);
+-      printf ("%srtx_equal_p (", invert_p ? "!" : "");
+-      print_test_rtx (os, test);
+-      printf (", operands[%d])", test.u.opno);
++      fprintf (f, "%srtx_equal_p (", invert_p ? "!" : "");
++      print_test_rtx (f, os, test);
++      fprintf (f, ", operands[%d])", test.u.opno);
+       break;
+ 
+     case rtx_test::HAVE_NUM_CLOBBERS:
+       gcc_assert (!is_param && value == 1);
+-      printf ("pnum_clobbers %s NULL", invert_p ? "==" : "!=");
++      fprintf (f, "pnum_clobbers %s NULL", invert_p ? "==" : "!=");
+       break;
+ 
+     case rtx_test::C_TEST:
+       gcc_assert (!is_param && value == 1);
+       if (invert_p)
+-	printf ("!");
+-      rtx_reader_ptr->print_c_condition (test.u.string);
++	fprintf (f, "!");
++      rtx_reader_ptr->print_c_condition (f, test.u.string);
+       break;
+ 
+     case rtx_test::ACCEPT:
+@@ -4771,7 +4774,7 @@ print_test (output_state *os, const rtx_test &test, bool is_param,
+     }
+ }
+ 
+-static exit_state print_decision (output_state *, decision *,
++static exit_state print_decision (FILE *f, output_state *, decision *,
+ 				  unsigned int, bool);
+ 
+ /* Print code to perform S, indent each line by INDENT spaces.
+@@ -4779,14 +4782,15 @@ static exit_state print_decision (output_state *, decision *,
+    if the state fails then the entire routine fails.  */
+ 
+ static exit_state
+-print_state (output_state *os, state *s, unsigned int indent, bool is_final)
++print_state (FILE *f, output_state *os, state *s, unsigned int indent,
++	     bool is_final)
+ {
+   exit_state es = ES_FALLTHROUGH;
+   for (decision *d = s->first; d; d = d->next)
+-    es = print_decision (os, d, indent, is_final && !d->next);
++    es = print_decision (f, os, d, indent, is_final && !d->next);
+   if (es != ES_RETURNED && is_final)
+     {
+-      printf_indent (indent, "return %s;\n", get_failure_return (os->type));
++      printf_indent (f, indent, "return %s;\n", get_failure_return (os->type));
+       es = ES_RETURNED;
+     }
+   return es;
+@@ -4797,7 +4801,7 @@ print_state (output_state *os, state *s, unsigned int indent, bool is_final)
+    match.  */
+ 
+ static const char *
+-print_subroutine_call (const acceptance_type &acceptance)
++print_subroutine_call (FILE *f, const acceptance_type &acceptance)
+ {
+   switch (acceptance.type)
+     {
+@@ -4805,17 +4809,17 @@ print_subroutine_call (const acceptance_type &acceptance)
+       gcc_unreachable ();
+ 
+     case RECOG:
+-      printf ("recog_%d (x1, insn, pnum_clobbers)",
+-	      acceptance.u.subroutine_id);
++      fprintf (f, "recog_%d (x1, insn, pnum_clobbers)",
++	       acceptance.u.subroutine_id);
+       return ">= 0";
+ 
+     case SPLIT:
+-      printf ("split_%d (x1, insn)", acceptance.u.subroutine_id);
++      fprintf (f, "split_%d (x1, insn)", acceptance.u.subroutine_id);
+       return "!= NULL_RTX";
+ 
+     case PEEPHOLE2:
+-      printf ("peephole2_%d (x1, insn, pmatch_len_)",
+-	      acceptance.u.subroutine_id);
++      fprintf (f, "peephole2_%d (x1, insn, pmatch_len_)",
++	       acceptance.u.subroutine_id);
+       return "!= NULL_RTX";
+     }
+   gcc_unreachable ();
+@@ -4825,63 +4829,65 @@ print_subroutine_call (const acceptance_type &acceptance)
+    INDENT and IS_FINAL are as for print_state.  */
+ 
+ static exit_state
+-print_acceptance (const acceptance_type &acceptance, unsigned int indent,
+-		  bool is_final)
++print_acceptance (FILE *f, const acceptance_type &acceptance,
++		  unsigned int indent, bool is_final)
+ {
+   if (acceptance.partial_p)
+     {
+       /* Defer the rest of the match to a subroutine.  */
+       if (is_final)
+ 	{
+-	  printf_indent (indent, "return ");
+-	  print_subroutine_call (acceptance);
+-	  printf (";\n");
++	  printf_indent (f, indent, "return ");
++	  print_subroutine_call (f, acceptance);
++	  fprintf (f, ";\n");
+ 	  return ES_RETURNED;
+ 	}
+       else
+ 	{
+-	  printf_indent (indent, "res = ");
+-	  const char *res_test = print_subroutine_call (acceptance);
+-	  printf (";\n");
+-	  printf_indent (indent, "if (res %s)\n", res_test);
+-	  printf_indent (indent + 2, "return res;\n");
++	  printf_indent (f, indent, "res = ");
++	  const char *res_test = print_subroutine_call (f, acceptance);
++	  fprintf (f, ";\n");
++	  printf_indent (f, indent, "if (res %s)\n", res_test);
++	  printf_indent (f, indent + 2, "return res;\n");
+ 	  return ES_FALLTHROUGH;
+ 	}
+     }
+   switch (acceptance.type)
+     {
+     case SUBPATTERN:
+-      printf_indent (indent, "return %d;\n", acceptance.u.full.code);
++      printf_indent (f, indent, "return %d;\n", acceptance.u.full.code);
+       return ES_RETURNED;
+ 
+     case RECOG:
+       if (acceptance.u.full.u.num_clobbers != 0)
+-	printf_indent (indent, "*pnum_clobbers = %d;\n",
++	printf_indent (f, indent, "*pnum_clobbers = %d;\n",
+ 		       acceptance.u.full.u.num_clobbers);
+-      printf_indent (indent, "return %d; /* %s */\n", acceptance.u.full.code,
++      printf_indent (f, indent, "return %d; /* %s */\n", acceptance.u.full.code,
+ 		     get_insn_name (acceptance.u.full.code));
+       return ES_RETURNED;
+ 
+     case SPLIT:
+-      printf_indent (indent, "return gen_split_%d (insn, operands);\n",
++      printf_indent (f, indent, "return gen_split_%d (insn, operands);\n",
+ 		     acceptance.u.full.code);
+       return ES_RETURNED;
+ 
+     case PEEPHOLE2:
+-      printf_indent (indent, "*pmatch_len_ = %d;\n",
++      printf_indent (f, indent, "*pmatch_len_ = %d;\n",
+ 		     acceptance.u.full.u.match_len);
+       if (is_final)
+ 	{
+-	  printf_indent (indent, "return gen_peephole2_%d (insn, operands);\n",
++	  printf_indent (f, indent,
++			 "return gen_peephole2_%d (insn, operands);\n",
+ 			 acceptance.u.full.code);
+ 	  return ES_RETURNED;
+ 	}
+       else
+ 	{
+-	  printf_indent (indent, "res = gen_peephole2_%d (insn, operands);\n",
++	  printf_indent (f,
++			 indent, "res = gen_peephole2_%d (insn, operands);\n",
+ 			 acceptance.u.full.code);
+-	  printf_indent (indent, "if (res != NULL_RTX)\n");
+-	  printf_indent (indent + 2, "return res;\n");
++	  printf_indent (f, indent, "if (res != NULL_RTX)\n");
++	  printf_indent (f, indent + 2, "return res;\n");
+ 	  return ES_FALLTHROUGH;
+ 	}
+     }
+@@ -4891,7 +4897,7 @@ print_acceptance (const acceptance_type &acceptance, unsigned int indent,
+ /* Print code to perform D.  INDENT and IS_FINAL are as for print_state.  */
+ 
+ static exit_state
+-print_decision (output_state *os, decision *d, unsigned int indent,
++print_decision (FILE *f, output_state *os, decision *d, unsigned int indent,
+ 		bool is_final)
+ {
+   uint64_t label;
+@@ -4900,7 +4906,7 @@ print_decision (output_state *os, decision *d, unsigned int indent,
+   /* Make sure the rtx under test is available either in operands[] or
+      in an xN variable.  */
+   if (d->test.pos && d->test.pos_operand < 0)
+-    change_state (os, d->test.pos, indent);
++    change_state (f, os, d->test.pos, indent);
+ 
+   /* Look for cases where a pattern routine P1 calls another pattern routine
+      P2 and where P1 returns X + BASE whenever P2 returns X.  If IS_FINAL
+@@ -4924,32 +4930,32 @@ print_decision (output_state *os, decision *d, unsigned int indent,
+     {
+       if (is_final && base == 0)
+ 	{
+-	  printf_indent (indent, "return ");
+-	  print_nonbool_test (os, d->test);
+-	  printf ("; /* [-1, %d] */\n", count - 1);
++	  printf_indent (f, indent, "return ");
++	  print_nonbool_test (f, os, d->test);
++	  fprintf (f, "; /* [-1, %d] */\n", count - 1);
+ 	  return ES_RETURNED;
+ 	}
+       else
+ 	{
+-	  printf_indent (indent, "res = ");
+-	  print_nonbool_test (os, d->test);
+-	  printf (";\n");
+-	  printf_indent (indent, "if (res >= 0)\n");
+-	  printf_indent (indent + 2, "return res");
++	  printf_indent (f, indent, "res = ");
++	  print_nonbool_test (f, os, d->test);
++	  fprintf (f, ";\n");
++	  printf_indent (f, indent, "if (res >= 0)\n");
++	  printf_indent (f, indent + 2, "return res");
+ 	  if (base != 0)
+-	    printf (" + %d", base);
+-	  printf ("; /* [%d, %d] */\n", base, base + count - 1);
++	    fprintf (f, " + %d", base);
++	  fprintf (f, "; /* [%d, %d] */\n", base, base + count - 1);
+ 	  return ES_FALLTHROUGH;
+ 	}
+     }
+   else if (d->test.kind == rtx_test::ACCEPT)
+-    return print_acceptance (d->test.u.acceptance, indent, is_final);
++    return print_acceptance (f, d->test.u.acceptance, indent, is_final);
+   else if (d->test.kind == rtx_test::SET_OP)
+     {
+-      printf_indent (indent, "operands[%d] = ", d->test.u.opno);
+-      print_test_rtx (os, d->test);
+-      printf (";\n");
+-      return print_state (os, d->singleton ()->to, indent, is_final);
++      printf_indent (f, indent, "operands[%d] = ", d->test.u.opno);
++      print_test_rtx (f, os, d->test);
++      fprintf (f, ";\n");
++      return print_state (f, os, d->singleton ()->to, indent, is_final);
+     }
+   /* Handle decisions with a single transition and a single transition
+      label.  */
+@@ -4957,13 +4963,13 @@ print_decision (output_state *os, decision *d, unsigned int indent,
+     {
+       transition *trans = d->singleton ();
+       if (mark_optional_transitions_p && trans->optional)
+-	printf_indent (indent, "/* OPTIONAL IF */\n");
++	printf_indent (f, indent, "/* OPTIONAL IF */\n");
+ 
+       /* Print the condition associated with TRANS.  Invert it if IS_FINAL,
+ 	 so that we return immediately on failure and fall through on
+ 	 success.  */
+-      printf_indent (indent, "if (");
+-      print_test (os, d->test, trans->is_param, label, is_final);
++      printf_indent (f, indent, "if (");
++      print_test (f, os, d->test, trans->is_param, label, is_final);
+ 
+       /* Look for following states that would be handled by this code
+ 	 on recursion.  If they don't need any preparatory statements,
+@@ -4979,13 +4985,13 @@ print_decision (output_state *os, decision *d, unsigned int indent,
+ 	      || !test_position_available_p (os, d->test))
+ 	    break;
+ 	  trans = d->first;
+-	  printf ("\n");
++	  fprintf (f, "\n");
+ 	  if (mark_optional_transitions_p && trans->optional)
+-	    printf_indent (indent + 4, "/* OPTIONAL IF */\n");
+-	  printf_indent (indent + 4, "%s ", is_final ? "||" : "&&");
+-	  print_test (os, d->test, trans->is_param, label, is_final);
++	    printf_indent (f, indent + 4, "/* OPTIONAL IF */\n");
++	  printf_indent (f, indent + 4, "%s ", is_final ? "||" : "&&");
++	  print_test (f, os, d->test, trans->is_param, label, is_final);
+ 	}
+-      printf (")\n");
++      fprintf (f, ")\n");
+ 
+       /* Print the conditional code with INDENT + 2 and the fallthrough
+ 	 code with indent INDENT.  */
+@@ -4994,9 +5000,9 @@ print_decision (output_state *os, decision *d, unsigned int indent,
+ 	{
+ 	  /* We inverted the condition above, so return failure in the
+ 	     "if" body and fall through to the target of the transition.  */
+-	  printf_indent (indent + 2, "return %s;\n",
++	  printf_indent (f, indent + 2, "return %s;\n",
+ 			 get_failure_return (os->type));
+-	  return print_state (os, to, indent, is_final);
++	  return print_state (f, os, to, indent, is_final);
+ 	}
+       else if (to->singleton ()
+ 	       && to->first->test.kind == rtx_test::ACCEPT
+@@ -5004,7 +5010,7 @@ print_decision (output_state *os, decision *d, unsigned int indent,
+ 	{
+ 	  /* The target of the transition is a simple "return" statement.
+ 	     It doesn't need any braces and doesn't fall through.  */
+-	  if (print_acceptance (to->first->test.u.acceptance,
++	  if (print_acceptance (f, to->first->test.u.acceptance,
+ 				indent + 2, true) != ES_RETURNED)
+ 	    gcc_unreachable ();
+ 	  return ES_FALLTHROUGH;
+@@ -5018,9 +5024,9 @@ print_decision (output_state *os, decision *d, unsigned int indent,
+ 	  auto_vec <bool, 32> old_seen;
+ 	  old_seen.safe_splice (os->seen_vars);
+ 
+-	  printf_indent (indent + 2, "{\n");
+-	  print_state (os, trans->to, indent + 4, is_final);
+-	  printf_indent (indent + 2, "}\n");
++	  printf_indent (f, indent + 2, "{\n");
++	  print_state (f, os, trans->to, indent + 4, is_final);
++	  printf_indent (f, indent + 2, "}\n");
+ 
+ 	  os->seen_vars.truncate (0);
+ 	  os->seen_vars.splice (old_seen);
+@@ -5030,48 +5036,48 @@ print_decision (output_state *os, decision *d, unsigned int indent,
+   else
+     {
+       /* Output the decision as a switch statement.  */
+-      printf_indent (indent, "switch (");
+-      print_nonbool_test (os, d->test);
+-      printf (")\n");
++      printf_indent (f, indent, "switch (");
++      print_nonbool_test (f, os, d->test);
++      fprintf (f, ")\n");
+ 
+       /* Each case statement starts with the same set of valid variables.
+ 	 These are also the only variables will be valid on fallthrough.  */
+       auto_vec <bool, 32> old_seen;
+       old_seen.safe_splice (os->seen_vars);
+ 
+-      printf_indent (indent + 2, "{\n");
++      printf_indent (f, indent + 2, "{\n");
+       for (transition *trans = d->first; trans; trans = trans->next)
+ 	{
+ 	  gcc_assert (!trans->is_param);
+ 	  if (mark_optional_transitions_p && trans->optional)
+-	    printf_indent (indent + 2, "/* OPTIONAL CASE */\n");
++	    printf_indent (f, indent + 2, "/* OPTIONAL CASE */\n");
+ 	  for (int_set::iterator j = trans->labels.begin ();
+ 	       j != trans->labels.end (); ++j)
+ 	    {
+-	      printf_indent (indent + 2, "case ");
+-	      print_label_value (d->test, trans->is_param, *j);
+-	      printf (":\n");
++	      printf_indent (f, indent + 2, "case ");
++	      print_label_value (f, d->test, trans->is_param, *j);
++	      fprintf (f, ":\n");
+ 	    }
+-	  if (print_state (os, trans->to, indent + 4, is_final))
++	  if (print_state (f, os, trans->to, indent + 4, is_final))
+ 	    {
+ 	      /* The state can fall through.  Add an explicit break.  */
+ 	      gcc_assert (!is_final);
+-	      printf_indent (indent + 4, "break;\n");
++	      printf_indent (f, indent + 4, "break;\n");
+ 	    }
+-	  printf ("\n");
++	  fprintf (f, "\n");
+ 
+ 	  /* Restore the original set of valid variables.  */
+ 	  os->seen_vars.truncate (0);
+ 	  os->seen_vars.splice (old_seen);
+ 	}
+       /* Add a default case.  */
+-      printf_indent (indent + 2, "default:\n");
++      printf_indent (f, indent + 2, "default:\n");
+       if (is_final)
+-	printf_indent (indent + 4, "return %s;\n",
++	printf_indent (f, indent + 4, "return %s;\n",
+ 		       get_failure_return (os->type));
+       else
+-	printf_indent (indent + 4, "break;\n");
+-      printf_indent (indent + 2, "}\n");
++	printf_indent (f, indent + 4, "break;\n");
++      printf_indent (f, indent + 2, "}\n");
+       return is_final ? ES_RETURNED : ES_FALLTHROUGH;
+     }
+ }
+@@ -5114,10 +5120,10 @@ assign_position_vars (output_state *os, state *s)
+    only ROOT's variable has a valid value.  */
+ 
+ static void
+-print_subroutine_start (output_state *os, state *s, position *root)
++print_subroutine_start (FILE *f, output_state *os, state *s, position *root)
+ {
+-  printf ("{\n  rtx * const operands ATTRIBUTE_UNUSED"
+-	  " = &recog_data.operand[0];\n");
++  fprintf (f, "{\n  rtx * const operands ATTRIBUTE_UNUSED"
++	   " = &recog_data.operand[0];\n");
+   os->var_to_id.truncate (0);
+   os->seen_vars.truncate (0);
+   if (root)
+@@ -5140,9 +5146,9 @@ print_subroutine_start (output_state *os, state *s, position *root)
+ 	{
+ 	  for (unsigned int i = 2; i < num_vars; ++i)
+ 	    /* Print 8 rtx variables to a line.  */
+-	    printf ("%s x%d",
++	    fprintf (f, "%s x%d",
+ 		    i == 2 ? "  rtx" : (i - 2) % 8 == 0 ? ";\n  rtx" : ",", i);
+-	  printf (";\n");
++	  fprintf (f, ";\n");
+ 	}
+ 
+       /* Say that x1 is valid and the rest aren't.  */
+@@ -5150,22 +5156,26 @@ print_subroutine_start (output_state *os, state *s, position *root)
+       os->seen_vars[1] = true;
+     }
+   if (os->type == SUBPATTERN || os->type == RECOG)
+-    printf ("  int res ATTRIBUTE_UNUSED;\n");
++    fprintf (f, "  int res ATTRIBUTE_UNUSED;\n");
+   else
+-    printf ("  rtx_insn *res ATTRIBUTE_UNUSED;\n");
++    fprintf (f, "  rtx_insn *res ATTRIBUTE_UNUSED;\n");
+ }
+ 
+ /* Output the definition of pattern routine ROUTINE.  */
+ 
+ static void
+-print_pattern (output_state *os, pattern_routine *routine)
++print_pattern (FILE *f, output_state *os, pattern_routine *routine,
++	       bool in_header = false)
+ {
+-  printf ("\nstatic int\npattern%d (", routine->pattern_id);
++  if (!in_header)
++    fprintf (f, "\nint\npattern%d (", routine->pattern_id);
++  else
++    fprintf (f, "\nextern int\npattern%d (", routine->pattern_id);
+   const char *sep = "";
+   /* Add the top-level rtx parameter, if any.  */
+   if (routine->pos)
+     {
+-      printf ("%srtx x1", sep);
++      fprintf (f, "%srtx x1", sep);
+       sep = ", ";
+     }
+   /* Add the optional parameters.  */
+@@ -5173,26 +5183,34 @@ print_pattern (output_state *os, pattern_routine *routine)
+     {
+       /* We can't easily tell whether a C condition actually reads INSN,
+ 	 so add an ATTRIBUTE_UNUSED just in case.  */
+-      printf ("%srtx_insn *insn ATTRIBUTE_UNUSED", sep);
++      fprintf (f, "%srtx_insn *insn ATTRIBUTE_UNUSED", sep);
+       sep = ", ";
+     }
+   if (routine->pnum_clobbers_p)
+     {
+-      printf ("%sint *pnum_clobbers", sep);
++      fprintf (f, "%sint *pnum_clobbers", sep);
+       sep = ", ";
+     }
+   /* Add the "i" parameters.  */
+   for (unsigned int i = 0; i < routine->param_types.length (); ++i)
+     {
+-      printf ("%s%s i%d", sep,
+-	      parameter_type_string (routine->param_types[i]), i + 1);
++      fprintf (f, "%s%s i%d", sep,
++	       parameter_type_string (routine->param_types[i]), i + 1);
+       sep = ", ";
+     }
+-  printf (")\n");
++
++  if (!in_header)
++    fprintf (f, ")\n");
++  else
++    {
++      fprintf (f, ");\n");
++      return;
++    }
++
+   os->type = SUBPATTERN;
+-  print_subroutine_start (os, routine->s, routine->pos);
+-  print_state (os, routine->s, 2, true);
+-  printf ("}\n");
++  print_subroutine_start (f, os, routine->s, routine->pos);
++  print_state (f, os, routine->s, 2, true);
++  fprintf (f, "}\n");
+ }
+ 
+ /* Output a routine of type TYPE that implements S.  PROC_ID is the
+@@ -5200,9 +5218,26 @@ print_pattern (output_state *os, pattern_routine *routine)
+    routine.  */
+ 
+ static void
+-print_subroutine (output_state *os, state *s, int proc_id)
+-{
+-  printf ("\n");
++print_subroutine (FILE *f, output_state *os, state *s, int proc_id,
++		  bool in_header = false)
++{
++  fprintf (f, "\n");
++  const char *specifier_ext = "extern";
++  const char *specifier_default = "";
++  const char *specifier;
++  if (!in_header)
++    specifier = specifier_default;
++  else
++    specifier = specifier_ext;
++
++  const char *end;
++  const char *end_default = "";
++  const char *end_header = ";";
++  if (!in_header)
++    end = end_default;
++  else
++    end = end_header;
++
+   switch (os->type)
+     {
+     case SUBPATTERN:
+@@ -5210,46 +5245,54 @@ print_subroutine (output_state *os, state *s, int proc_id)
+ 
+     case RECOG:
+       if (proc_id)
+-	printf ("static int\nrecog_%d", proc_id);
++	fprintf (f, "%s int\nrecog_%d", specifier, proc_id);
+       else
+-	printf ("int\nrecog");
+-      printf (" (rtx x1 ATTRIBUTE_UNUSED,\n"
+-	      "\trtx_insn *insn ATTRIBUTE_UNUSED,\n"
+-	      "\tint *pnum_clobbers ATTRIBUTE_UNUSED)\n");
++	fprintf (f, "%s int\nrecog", specifier);
++      fprintf (f, " (rtx x1 ATTRIBUTE_UNUSED,\n"
++	       "\trtx_insn *insn ATTRIBUTE_UNUSED,\n"
++	       "\tint *pnum_clobbers ATTRIBUTE_UNUSED)%s\n", end);
+       break;
+ 
+     case SPLIT:
+       if (proc_id)
+-	printf ("static rtx_insn *\nsplit_%d", proc_id);
++	fprintf (f, "%s rtx_insn *\nsplit_%d", specifier, proc_id);
+       else
+-	printf ("rtx_insn *\nsplit_insns");
+-      printf (" (rtx x1 ATTRIBUTE_UNUSED, rtx_insn *insn ATTRIBUTE_UNUSED)\n");
++	fprintf (f, "%s rtx_insn *\nsplit_insns", specifier);
++      fprintf (f, " (rtx x1 ATTRIBUTE_UNUSED, "
++		  "rtx_insn *insn ATTRIBUTE_UNUSED)%s\n", end);
+       break;
+ 
+     case PEEPHOLE2:
+       if (proc_id)
+-	printf ("static rtx_insn *\npeephole2_%d", proc_id);
++	fprintf (f, "%s rtx_insn *\npeephole2_%d", specifier, proc_id);
+       else
+-	printf ("rtx_insn *\npeephole2_insns");
+-      printf (" (rtx x1 ATTRIBUTE_UNUSED,\n"
+-	      "\trtx_insn *insn ATTRIBUTE_UNUSED,\n"
+-	      "\tint *pmatch_len_ ATTRIBUTE_UNUSED)\n");
++	fprintf (f, "%s rtx_insn *\npeephole2_insns", specifier);
++      fprintf (f, " (rtx x1 ATTRIBUTE_UNUSED,\n"
++	       "\trtx_insn *insn ATTRIBUTE_UNUSED,\n"
++	       "\tint *pmatch_len_ ATTRIBUTE_UNUSED)%s\n", end);
+       break;
+     }
+-  print_subroutine_start (os, s, &root_pos);
++
++  if (in_header)
++    return;
++
++  print_subroutine_start (f, os, s, &root_pos);
+   if (proc_id == 0)
+     {
+-      printf ("  recog_data.insn = NULL;\n");
++      fprintf (f, "  recog_data.insn = NULL;\n");
+     }
+-  print_state (os, s, 2, true);
+-  printf ("}\n");
++  print_state (f, os, s, 2, true);
++  fprintf (f, "}\n");
+ }
+ 
+ /* Print out a routine of type TYPE that performs ROOT.  */
+ 
+ static void
+-print_subroutine_group (output_state *os, routine_type type, state *root)
++print_subroutine_group (vec<FILE *> &vec, FILE *header, output_state *os,
++			routine_type type, state *root)
+ {
++  FILE *f;
++  unsigned idx;
+   os->type = type;
+   if (use_subroutines_p)
+     {
+@@ -5261,11 +5304,20 @@ print_subroutine_group (output_state *os, routine_type type, state *root)
+       /* Output the subroutines (but not ROOT itself).  */
+       unsigned int i;
+       state *s;
++
++      FILE *f = header;
++      FOR_EACH_VEC_ELT (subroutines, i, s)
++	print_subroutine (header, os, s, i + 1, true);
++
+       FOR_EACH_VEC_ELT (subroutines, i, s)
+-	print_subroutine (os, s, i + 1);
++	{
++	  f = choose_output (vec, idx);
++	  print_subroutine (f, os, s, i + 1);
++	}
+     }
+   /* Output the main routine.  */
+-  print_subroutine (os, root, 0);
++  f = choose_output (vec, idx);
++  print_subroutine (f, os, root, 0);
+ }
+ 
+ /* Return the rtx pattern for the list of rtxes in a define_peephole2.  */
+@@ -5336,6 +5388,29 @@ remove_clobbers (acceptance_type *acceptance_ptr, rtx *pattern_ptr)
+   return true;
+ }
+ 
++auto_vec<FILE *, 10> output_files;
++char header_name[255];
++FILE *header = NULL;
++
++static bool
++handle_arg (const char *arg)
++{
++  printf ("%s\n", arg);
++  if (arg[1] == 'O')
++    {
++      FILE *file = fopen (&arg[2], "w");
++      output_files.safe_push (file);
++      return true;
++    }
++  if (arg[1] == 'H')
++    {
++      snprintf (header_name, 255, "%s", &arg[2]);
++      header = fopen (header_name, "w");
++      return true;
++    }
++  return false;
++}
++
+ int
+ main (int argc, const char **argv)
+ {
+@@ -5343,10 +5418,17 @@ main (int argc, const char **argv)
+ 
+   progname = "genrecog";
+ 
+-  if (!init_rtx_reader_args (argc, argv))
++  if (!init_rtx_reader_args_cb (argc, argv, handle_arg))
+     return (FATAL_EXIT_CODE);
+ 
+-  write_header ();
++  if (output_files.is_empty ())
++    output_files.safe_push (stdout);
++
++  for (auto f : output_files)
++    write_header (f, header_name);
++
++  FILE *file = NULL;
++  unsigned file_idx;
+ 
+   /* Read the machine description.  */
+ 
+@@ -5354,6 +5436,7 @@ main (int argc, const char **argv)
+   while (read_md_rtx (&info))
+     {
+       rtx def = info.def;
++      file = choose_output (output_files, file_idx);
+ 
+       acceptance_type acceptance;
+       acceptance.partial_p = false;
+@@ -5387,8 +5470,8 @@ main (int argc, const char **argv)
+ 
+ 	  /* Declare the gen_split routine that we'll call if the
+ 	     pattern matches.  The definition comes from insn-emit.cc.  */
+-	  printf ("extern rtx_insn *gen_split_%d (rtx_insn *, rtx *);\n",
+-		  info.index);
++	  fprintf (header, "extern rtx_insn *gen_split_%d "
++		   "(rtx_insn *, rtx *);\n", info.index);
+ 	  break;
+ 
+ 	case DEFINE_PEEPHOLE2:
+@@ -5399,8 +5482,8 @@ main (int argc, const char **argv)
+ 
+ 	  /* Declare the gen_peephole2 routine that we'll call if the
+ 	     pattern matches.  The definition comes from insn-emit.cc.  */
+-	  printf ("extern rtx_insn *gen_peephole2_%d (rtx_insn *, rtx *);\n",
+-		  info.index);
++	  fprintf (header, "extern rtx_insn *gen_peephole2_%d "
++		   "(rtx_insn *, rtx *);\n", info.index);
+ 	  break;
+ 
+ 	default:
+@@ -5411,7 +5494,8 @@ main (int argc, const char **argv)
+   if (have_error)
+     return FATAL_EXIT_CODE;
+ 
+-  puts ("\n\n");
++  for (auto f : output_files)
++    fprintf (f, "%s", "\n\n");
+ 
+   /* Optimize each routine in turn.  */
+   optimize_subroutine_group ("recog", &insn_root);
+@@ -5433,15 +5517,27 @@ main (int argc, const char **argv)
+       /* Print out the routines that we just created.  */
+       unsigned int i;
+       pattern_routine *routine;
++
+       FOR_EACH_VEC_ELT (patterns, i, routine)
+-	print_pattern (&os, routine);
++	print_pattern (header, &os, routine, true);
++
++      FOR_EACH_VEC_ELT (patterns, i, routine)
++	{
++	  file = choose_output (output_files, file_idx);
++	  print_pattern (file, &os, routine);
++	}
+     }
+ 
+   /* Print out the matching routines.  */
+-  print_subroutine_group (&os, RECOG, &insn_root);
+-  print_subroutine_group (&os, SPLIT, &split_root);
+-  print_subroutine_group (&os, PEEPHOLE2, &peephole2_root);
++  print_subroutine_group (output_files, header, &os, RECOG, &insn_root);
++  print_subroutine_group (output_files, header, &os, SPLIT, &split_root);
++  print_subroutine_group (output_files, header, &os, PEEPHOLE2, &peephole2_root);
++
++  fclose (header);
+ 
+-  fflush (stdout);
+-  return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
++  int ret = SUCCESS_EXIT_CODE;
++  for (FILE *f : output_files)
++    if (fclose (f) != 0)
++      ret = FATAL_EXIT_CODE;
++  return ret;
+ }
+diff --git a/gcc/gentarget-def.cc b/gcc/gentarget-def.cc
+index 061b1e7247c1..3a462560cc1b 100644
+--- a/gcc/gentarget-def.cc
++++ b/gcc/gentarget-def.cc
+@@ -191,7 +191,7 @@ def_target_insn (const char *name, const char *prototype)
+ 	      printf ("target_have_%s (void)\n", name);
+ 	      printf ("{\n");
+ 	      printf ("  return ");
+-	      rtx_reader_ptr->print_c_condition (test);
++	      rtx_reader_ptr->print_c_condition (stdout, test);
+ 	      printf (";\n");
+ 	      printf ("}\n");
+ 	    }
+diff --git a/gcc/read-md.cc b/gcc/read-md.cc
+index 93d1ea437812..aeb1cced00d0 100644
+--- a/gcc/read-md.cc
++++ b/gcc/read-md.cc
+@@ -192,9 +192,9 @@ md_reader::fprint_c_condition (FILE *outf, const char *cond)
+ /* Special fprint_c_condition for writing to STDOUT.  */
+ 
+ void
+-md_reader::print_c_condition (const char *cond)
++md_reader::print_c_condition (FILE *outf, const char *cond)
+ {
+-  fprint_c_condition (stdout, cond);
++  fprint_c_condition (outf, cond);
+ }
+ 
+ /* A vfprintf-like function for reporting an error against line LINENO
+diff --git a/gcc/read-md.h b/gcc/read-md.h
+index e613c42b7241..b42add391ed8 100644
+--- a/gcc/read-md.h
++++ b/gcc/read-md.h
+@@ -205,7 +205,7 @@ class md_reader
+ 
+   const char *join_c_conditions (const char *cond1, const char *cond2);
+   void fprint_c_condition (FILE *outf, const char *cond);
+-  void print_c_condition (const char *cond);
++  void print_c_condition (FILE *outf, const char *cond);
+ 
+   /* Defined in read-rtl.cc.  */
+   const char *apply_iterator_to_string (const char *string);
+
+base-commit: a22dfe208d94105a6e587a3b25e8fe8d62444d8a
+-- 
+2.47.1
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-11-30 11:30 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-11-30 11:30 UTC (permalink / raw
  To: gentoo-commits

commit:     d066fc8f8de408b4e8d9d12a93f19d60ec08e250
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 30 11:29:18 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 30 11:29:58 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d066fc8f

15.0.0: pass -fno-stack-protector for offloading

--enable-default-ssp doesn't seem to cover this.

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

 15.0.0/gentoo/04_all_nossp-on-nostdlib.patch | 2 +-
 15.0.0/gentoo/README.history                 | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/04_all_nossp-on-nostdlib.patch b/15.0.0/gentoo/04_all_nossp-on-nostdlib.patch
index e17b6a3..4462c0e 100644
--- a/15.0.0/gentoo/04_all_nossp-on-nostdlib.patch
+++ b/15.0.0/gentoo/04_all_nossp-on-nostdlib.patch
@@ -8,7 +8,7 @@ https://bugs.gentoo.org/484714
  #endif
  
 +#ifdef ENABLE_DEFAULT_SSP
-+#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} "
++#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} -foffload-options=-fno-stack-protector "
 +#else
 +#define NO_SSP_SPEC ""
 +#endif

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index f2fbcd7..fc9e803 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,6 +1,7 @@
 ??
 
 	- 72_all_PR111600-genemit-Distribute-evenly-to-files.patch
+	U 04_all_nossp-on-nostdlib.patch
 	U 26_all_enable-cet.patch
 
 28	25 November 2024


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-01 22:51 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-01 22:51 UTC (permalink / raw
  To: gentoo-commits

commit:     ff1de10818c52725954f2f02e718c05c231512e4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  1 22:49:19 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec  1 22:49:34 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ff1de108

15.0.0: rebase 28_all_drop_CFLAGS_sed.patch

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

 15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch | 12 ++++++------
 15.0.0/gentoo/README.history               |  1 +
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch b/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch
index 764f34c..fb514cb 100644
--- a/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch
+++ b/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch
@@ -3,7 +3,7 @@ https://github.com/InBetweenNames/gentooLTO/issues/846
 https://github.com/vaeth/portage-bashrc-mv/issues/11
 --- a/gcc/configure
 +++ b/gcc/configure
-@@ -5388,13 +5388,6 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
+@@ -5473,13 +5473,6 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
  ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
  
  
@@ -11,15 +11,15 @@ https://github.com/vaeth/portage-bashrc-mv/issues/11
 -# optimizations to be activated explicitly by the toplevel.
 -case "$CC" in
 -  */prev-gcc/xgcc*) ;;
--  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[ 	]//" -e "s/-O[gs][ 	]//" -e "s/-O[0-9]*[ 	]//" `
--     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[ 	]//" -e "s/-O[gs][ 	]//" -e "s/-O[0-9]*[ 	]//" ` ;;
+-  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[ 	]//" -e "s/-O[gs][ 	]//" -e "s/[^,]-O[0-9]*[ 	]//" `
+-     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[ 	]//" -e "s/-O[gs][ 	]//" -e "s/[^,]-O[0-9]*[ 	]//" ` ;;
 -esac
  
  
  
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
-@@ -440,13 +440,6 @@ ACX_PROG_GDC([-I"$srcdir"/d])
+@@ -463,13 +463,6 @@ ACX_PROG_GDC([-I"$srcdir"/d])
  # Do configure tests with the C++ compiler, since that's what we build with.
  AC_LANG(C++)
  
@@ -27,8 +27,8 @@ https://github.com/vaeth/portage-bashrc-mv/issues/11
 -# optimizations to be activated explicitly by the toplevel.
 -case "$CC" in
 -  */prev-gcc/xgcc*) ;;
--  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ 	]]//" -e "s/-O[[gs]][[ 	]]//" -e "s/-O[[0-9]]*[[ 	]]//" `
--     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ 	]]//" -e "s/-O[[gs]][[ 	]]//" -e "s/-O[[0-9]]*[[ 	]]//" ` ;;
+-  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ 	]]//" -e "s/-O[[gs]][[ 	]]//" -e "s/[[^,]]-O[[0-9]]*[[ 	]]//" `
+-     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ 	]]//" -e "s/-O[[gs]][[ 	]]//" -e "s/[[^,]]-O[[0-9]]*[[ 	]]//" ` ;;
 -esac
  AC_SUBST(CFLAGS)
  AC_SUBST(CXXFLAGS)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index fc9e803..2b369b3 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -3,6 +3,7 @@
 	- 72_all_PR111600-genemit-Distribute-evenly-to-files.patch
 	U 04_all_nossp-on-nostdlib.patch
 	U 26_all_enable-cet.patch
+	U 28_all_drop_CFLAGS_sed.patch
 
 28	25 November 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-01 22:51 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-01 22:51 UTC (permalink / raw
  To: gentoo-commits

commit:     327cf5e12642fc4d22c9a65971c11a4c6d22aebf
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  1 22:44:01 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec  1 22:49:34 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=327cf5e1

15.0.0: cut patchset 29

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 2b369b3..5fb36c9 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-??
+29	1 December 2024
 
 	- 72_all_PR111600-genemit-Distribute-evenly-to-files.patch
 	U 04_all_nossp-on-nostdlib.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-04 20:40 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-04 20:40 UTC (permalink / raw
  To: gentoo-commits

commit:     2c9ed0ca7f95939d71b6db53760b85a72847d173
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec  4 20:40:19 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec  4 20:40:19 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=2c9ed0ca

15.0.0: rebase 28_all_drop_CFLAGS_sed.patch

It might be this can be dropped now but it's still so brittle.

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

 15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch | 48 +++++++++++++++++++++++++-----
 1 file changed, 40 insertions(+), 8 deletions(-)

diff --git a/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch b/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch
index fb514cb..b160c92 100644
--- a/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch
+++ b/15.0.0/gentoo/28_all_drop_CFLAGS_sed.patch
@@ -3,32 +3,64 @@ https://github.com/InBetweenNames/gentooLTO/issues/846
 https://github.com/vaeth/portage-bashrc-mv/issues/11
 --- a/gcc/configure
 +++ b/gcc/configure
-@@ -5473,13 +5473,6 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
+@@ -5473,29 +5473,6 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
  ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
  
  
--# Remove the -O2: for historical reasons, unless bootstrapping we prefer
+-# Remove all -O flags: for historical reasons, unless bootstrapping we prefer
 -# optimizations to be activated explicitly by the toplevel.
 -case "$CC" in
 -  */prev-gcc/xgcc*) ;;
--  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[ 	]//" -e "s/-O[gs][ 	]//" -e "s/[^,]-O[0-9]*[ 	]//" `
--     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[ 	]//" -e "s/-O[gs][ 	]//" -e "s/[^,]-O[0-9]*[ 	]//" ` ;;
+-  *)
+-    new_CFLAGS=
+-    for flag in $CFLAGS; do
+-      case $flag in
+-	-O*) ;;
+-	*) new_CFLAGS="$new_CFLAGS $flag" ;;
+-      esac
+-    done
+-    CFLAGS=$new_CFLAGS
+-    new_CXXFLAGS=
+-    for flag in $CXXFLAGS; do
+-      case $flag in
+-	-O*) ;;
+-	*) new_CXXFLAGS="$new_CXXFLAGS $flag" ;;
+-      esac
+-    done
+-    CXXFLAGS=$new_CXXFLAGS
+-    ;;
 -esac
  
  
  
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
-@@ -463,13 +463,6 @@ ACX_PROG_GDC([-I"$srcdir"/d])
+@@ -463,29 +463,6 @@ ACX_PROG_GDC([-I"$srcdir"/d])
  # Do configure tests with the C++ compiler, since that's what we build with.
  AC_LANG(C++)
  
--# Remove the -O2: for historical reasons, unless bootstrapping we prefer
+-# Remove all -O flags: for historical reasons, unless bootstrapping we prefer
 -# optimizations to be activated explicitly by the toplevel.
 -case "$CC" in
 -  */prev-gcc/xgcc*) ;;
--  *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[[ 	]]//" -e "s/-O[[gs]][[ 	]]//" -e "s/[[^,]]-O[[0-9]]*[[ 	]]//" `
--     CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[[ 	]]//" -e "s/-O[[gs]][[ 	]]//" -e "s/[[^,]]-O[[0-9]]*[[ 	]]//" ` ;;
+-  *)
+-    new_CFLAGS=
+-    for flag in $CFLAGS; do
+-      case $flag in
+-	-O*) ;;
+-	*) new_CFLAGS="$new_CFLAGS $flag" ;;
+-      esac
+-    done
+-    CFLAGS=$new_CFLAGS
+-    new_CXXFLAGS=
+-    for flag in $CXXFLAGS; do
+-      case $flag in
+-	-O*) ;;
+-	*) new_CXXFLAGS="$new_CXXFLAGS $flag" ;;
+-      esac
+-    done
+-    CXXFLAGS=$new_CXXFLAGS
+-    ;;
 -esac
  AC_SUBST(CFLAGS)
  AC_SUBST(CXXFLAGS)


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-06 17:33 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-06 17:33 UTC (permalink / raw
  To: gentoo-commits

commit:     a702fbd08bae90ab51599a2bff41db041f43e881
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  6 17:33:27 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec  6 17:33:27 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=a702fbd0

15.0.0: add 73_all_PR117629-c-special-case-some-bool-errors-with-C23.patch

Not yet merged upstream but improves diagnostics and it was done partly
for us, so let's test it out.

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

 ...-c-special-case-some-bool-errors-with-C23.patch | 312 +++++++++++++++++++++
 15.0.0/gentoo/README.history                       |   4 +
 2 files changed, 316 insertions(+)

diff --git a/15.0.0/gentoo/73_all_PR117629-c-special-case-some-bool-errors-with-C23.patch b/15.0.0/gentoo/73_all_PR117629-c-special-case-some-bool-errors-with-C23.patch
new file mode 100644
index 0000000..3c3696e
--- /dev/null
+++ b/15.0.0/gentoo/73_all_PR117629-c-special-case-some-bool-errors-with-C23.patch
@@ -0,0 +1,312 @@
+https://inbox.sourceware.org/gcc-patches/20241126034902.1294094-1-dmalcolm@redhat.com/
+
+From 3d35e4348a0771cedc5a540f70eaa90f3ea68f23 Mon Sep 17 00:00:00 2001
+Message-ID: <3d35e4348a0771cedc5a540f70eaa90f3ea68f23.1733506366.git.sam@gentoo.org>
+From: David Malcolm <dmalcolm@redhat.com>
+Date: Mon, 25 Nov 2024 22:49:02 -0500
+Subject: [PATCH] c: special-case some "bool" errors with C23 [PR117629]
+
+This patch attempts to provide better error messages for
+code compiled with C23 that hasn't been updated for
+"bool", "true", and "false" becoming keywords (based on
+a brief review of the Gentoo bug tracker links given at
+https://gcc.gnu.org/pipermail/gcc/2024-November/245185.html).
+
+Specifically:
+
+(1) with "typedef int bool;" previously we emitted:
+
+t1.c:7:13: error: two or more data types in declaration specifiers
+    7 | typedef int bool;
+      |             ^~~~
+t1.c:7:1: warning: useless type name in empty declaration
+    7 | typedef int bool;
+      | ^~~~~~~
+
+whereas with this patch we emit:
+
+t1.c:7:13: error: 'bool' cannot be defined via 'typedef'
+    7 | typedef int bool;
+      |             ^~~~
+t1.c:7:13: note: 'bool' is a keyword with '-std=c23' onwards
+t1.c:7:1: warning: useless type name in empty declaration
+    7 | typedef int bool;
+      | ^~~~~~~
+
+(2) with "int bool;" previously we emitted:
+
+t2.c:7:5: error: two or more data types in declaration specifiers
+    7 | int bool;
+      |     ^~~~
+t2.c:7:1: warning: useless type name in empty declaration
+    7 | int bool;
+      | ^~~
+
+whereas with this patch we emit:
+
+t2.c:7:5: error: 'bool' cannot be used here
+    7 | int bool;
+      |     ^~~~
+t2.c:7:5: note: 'bool' is a keyword with '-std=c23' onwards
+t2.c:7:1: warning: useless type name in empty declaration
+    7 | int bool;
+      | ^~~
+
+(3) with "typedef enum { false = 0, true = 1 } _Bool;" previously we
+emitted:
+
+t3.c:7:16: error: expected identifier before 'false'
+    7 | typedef enum { false = 0, true = 1 } _Bool;
+      |                ^~~~~
+t3.c:7:38: error: expected ';', identifier or '(' before '_Bool'
+    7 | typedef enum { false = 0, true = 1 } _Bool;
+      |                                      ^~~~~
+t3.c:7:38: warning: useless type name in empty declaration
+
+whereas with this patch we emit:
+
+t3.c:7:16: error: cannot use keyword 'false' as enumeration constant
+    7 | typedef enum { false = 0, true = 1 } _Bool;
+      |                ^~~~~
+t3.c:7:16: note: 'false' is a keyword with '-std=c23' onwards
+t3.c:7:38: error: expected ';', identifier or '(' before '_Bool'
+    7 | typedef enum { false = 0, true = 1 } _Bool;
+      |                                      ^~~~~
+t3.c:7:38: warning: useless type name in empty declaration
+
+Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
+OK for trunk?
+
+gcc/c/ChangeLog:
+	PR c/117629
+	* c-decl.cc (declspecs_add_type): Special-case attempts to use
+	bool as a typedef name or declaration name.
+	* c-errors.cc (add_note_about_new_keyword): New.
+	* c-parser.cc (report_bad_enum_name): New, split out from...
+	(c_parser_enum_specifier): ...here, adding handling for RID_FALSE
+	and RID_TRUE.
+	* c-tree.h (add_note_about_new_keyword): New decl.
+
+gcc/testsuite/ChangeLog:
+	PR c/117629
+	* gcc.dg/auto-type-2.c: Update expected output with _Bool.
+	* gcc.dg/c23-bool-errors-1.c: New test.
+	* gcc.dg/c23-bool-errors-2.c: New test.
+	* gcc.dg/c23-bool-errors-3.c: New test.
+
+Signed-off-by: David Malcolm <dmalcolm@redhat.com>
+---
+ gcc/c/c-decl.cc                          | 18 +++++++-
+ gcc/c/c-errors.cc                        | 13 ++++++
+ gcc/c/c-parser.cc                        | 53 +++++++++++++++++++-----
+ gcc/c/c-tree.h                           |  3 ++
+ gcc/testsuite/gcc.dg/auto-type-2.c       |  2 +-
+ gcc/testsuite/gcc.dg/c23-bool-errors-1.c |  9 ++++
+ gcc/testsuite/gcc.dg/c23-bool-errors-2.c |  9 ++++
+ gcc/testsuite/gcc.dg/c23-bool-errors-3.c | 15 +++++++
+ 8 files changed, 109 insertions(+), 13 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/c23-bool-errors-1.c
+ create mode 100644 gcc/testsuite/gcc.dg/c23-bool-errors-2.c
+ create mode 100644 gcc/testsuite/gcc.dg/c23-bool-errors-3.c
+
+diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc
+index 7abf1921b577..91d5fee50402 100644
+--- a/gcc/c/c-decl.cc
++++ b/gcc/c/c-decl.cc
+@@ -12493,8 +12493,22 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
+ 	     "__auto_type".  */
+ 	  if (specs->typespec_word != cts_none)
+ 	    {
+-	      error_at (loc,
+-			"two or more data types in declaration specifiers");
++	      if (i == RID_BOOL)
++		{
++		  auto_diagnostic_group d;
++		  if (specs->storage_class == csc_typedef)
++		    error_at (loc,
++			      "%qs cannot be defined via %<typedef%>",
++			      IDENTIFIER_POINTER (type));
++		  else
++		    error_at (loc,
++			      "%qs cannot be used here",
++			      IDENTIFIER_POINTER (type));
++		  add_note_about_new_keyword (loc, type, "-std=c23");
++		}
++	      else
++		error_at (loc,
++			  "two or more data types in declaration specifiers");
+ 	      return specs;
+ 	    }
+ 	  switch (i)
+diff --git a/gcc/c/c-errors.cc b/gcc/c/c-errors.cc
+index 77f008eba1c2..cc9bb128ee8b 100644
+--- a/gcc/c/c-errors.cc
++++ b/gcc/c/c-errors.cc
+@@ -215,3 +215,16 @@ out:
+   va_end (ap);
+   return warned;
+ }
++
++/* Issue a note to the user at LOC that KEYWORD_ID is a keyword
++   in STD_OPTION version of the standard onwards.  */
++
++void
++add_note_about_new_keyword (location_t loc,
++			    tree keyword_id,
++			    const char *std_option)
++{
++  gcc_assert (TREE_CODE (keyword_id) == IDENTIFIER_NODE);
++  inform (loc, "%qs is a keyword with %qs onwards",
++	  IDENTIFIER_POINTER (keyword_id), std_option);
++}
+diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
+index 4ec0ee85ac49..18ba82e83f02 100644
+--- a/gcc/c/c-parser.cc
++++ b/gcc/c/c-parser.cc
+@@ -3785,6 +3785,48 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
+     specs->postfix_attrs = c_parser_std_attribute_specifier_sequence (parser);
+ }
+ 
++/* Complain about a non-CPP_NAME within an enumerator list.  */
++
++static void
++report_bad_enum_name (c_parser *parser)
++{
++  if (!parser->error)
++    {
++      c_token *token = c_parser_peek_token (parser);
++      switch (token->type)
++	{
++	default:
++	  break;
++	case CPP_CLOSE_BRACE:
++	  /* Give a nicer error for "enum {}".  */
++	  error_at (token->location,
++		    "empty enum is invalid");
++	  parser->error = true;
++	  return;
++	case CPP_KEYWORD:
++	  /* Give a nicer error for attempts to use "true" and "false"
++	     in enums with C23 onwards.  */
++	  if (token->keyword == RID_FALSE
++	      || token->keyword == RID_TRUE)
++	    {
++	      auto_diagnostic_group d;
++	      error_at (token->location,
++			"cannot use keyword %qs as enumeration constant",
++			IDENTIFIER_POINTER (token->value));
++	      add_note_about_new_keyword (token->location,
++					  token->value,
++					  "-std=c23");
++	      parser->error = true;
++	      return;
++	    }
++	  break;
++	}
++    }
++
++  /* Otherwise, a more generic error message.  */
++  c_parser_error (parser, "expected identifier");
++}
++
+ /* Parse an enum specifier (C90 6.5.2.2, C99 6.7.2.2, C11 6.7.2.2).
+ 
+    enum-specifier:
+@@ -3952,16 +3994,7 @@ c_parser_enum_specifier (c_parser *parser)
+ 	  location_t decl_loc, value_loc;
+ 	  if (c_parser_next_token_is_not (parser, CPP_NAME))
+ 	    {
+-	      /* Give a nicer error for "enum {}".  */
+-	      if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE)
+-		  && !parser->error)
+-		{
+-		  error_at (c_parser_peek_token (parser)->location,
+-			    "empty enum is invalid");
+-		  parser->error = true;
+-		}
+-	      else
+-		c_parser_error (parser, "expected identifier");
++	      report_bad_enum_name (parser);
+ 	      c_parser_skip_until_found (parser, CPP_CLOSE_BRACE, NULL);
+ 	      values = error_mark_node;
+ 	      break;
+diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
+index d39bd238103e..e98bd4f2fd8d 100644
+--- a/gcc/c/c-tree.h
++++ b/gcc/c/c-tree.h
+@@ -955,6 +955,9 @@ extern bool pedwarn_c11 (location_t, diagnostic_option_id, const char *, ...)
+     ATTRIBUTE_GCC_DIAG(3,4);
+ extern bool pedwarn_c23 (location_t, diagnostic_option_id, const char *, ...)
+     ATTRIBUTE_GCC_DIAG(3,4);
++extern void add_note_about_new_keyword (location_t loc,
++					tree keyword_id,
++					const char *std_option);
+ 
+ extern void
+ set_c_expr_source_range (c_expr *expr,
+diff --git a/gcc/testsuite/gcc.dg/auto-type-2.c b/gcc/testsuite/gcc.dg/auto-type-2.c
+index 761671b3c5a4..f484acb4c916 100644
+--- a/gcc/testsuite/gcc.dg/auto-type-2.c
++++ b/gcc/testsuite/gcc.dg/auto-type-2.c
+@@ -20,4 +20,4 @@ signed __auto_type e7 = 0; /* { dg-error "__auto_type" } */
+ unsigned __auto_type e8 = 0; /* { dg-error "__auto_type" } */
+ _Complex __auto_type e9 = 0; /* { dg-error "__auto_type" } */
+ int __auto_type e10 = 0; /* { dg-error "two or more data types" } */
+-__auto_type _Bool e11 = 0; /* { dg-error "two or more data types" } */
++__auto_type _Bool e11 = 0; /* { dg-error "'_Bool' cannot be used here" } */
+diff --git a/gcc/testsuite/gcc.dg/c23-bool-errors-1.c b/gcc/testsuite/gcc.dg/c23-bool-errors-1.c
+new file mode 100644
+index 000000000000..8a33d36a8891
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/c23-bool-errors-1.c
+@@ -0,0 +1,9 @@
++/* Test error-handling for legacy code that tries to
++   define "bool" with C23.  */
++
++/* { dg-do compile } */
++/* { dg-options "-std=c23" } */
++
++typedef int bool; /* { dg-error "'bool' cannot be defined via 'typedef'" } */
++/* { dg-message "'bool' is a keyword with '-std=c23' onwards" "" { target *-*-* } .-1 } */
++/* { dg-warning "useless type name in empty declaration"  "" { target *-*-* } .-2 } */
+diff --git a/gcc/testsuite/gcc.dg/c23-bool-errors-2.c b/gcc/testsuite/gcc.dg/c23-bool-errors-2.c
+new file mode 100644
+index 000000000000..1a66e3aea67e
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/c23-bool-errors-2.c
+@@ -0,0 +1,9 @@
++/* Test error-handling for legacy code that tries to
++   use a variable named "bool" with C23.  */
++
++/* { dg-do compile } */
++/* { dg-options "-std=c23" } */
++
++int bool; /* { dg-error "'bool' cannot be used here" } */
++/* { dg-message "'bool' is a keyword with '-std=c23' onwards" "" { target *-*-* } .-1 } */
++/* { dg-warning "useless type name in empty declaration" "" { target *-*-* } .-2 } */
+diff --git a/gcc/testsuite/gcc.dg/c23-bool-errors-3.c b/gcc/testsuite/gcc.dg/c23-bool-errors-3.c
+new file mode 100644
+index 000000000000..634c8ac45a52
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/c23-bool-errors-3.c
+@@ -0,0 +1,15 @@
++/* Test error-handling for legacy code that tries to
++   define "false" or "true" within enums with C23.  */
++
++/* { dg-do compile } */
++/* { dg-options "-std=c23" } */
++
++typedef enum { false = 0, true = 1 } _Bool; /* { dg-error "cannot use keyword 'false' as enumeration constant" }
++/* { dg-message "'false' is a keyword with '-std=c23' onwards" "" { target *-*-* } .-1 } */
++/* { dg-error "38: expected ';', identifier or '\\\(' before '_Bool'" "" { target *-*-* } .-2 } */
++/* { dg-warning "38: useless type name in empty declaration" "" { target *-*-* } .-3 } */
++
++typedef enum { true = 1, false = 0 } _Bool; /* { dg-error "cannot use keyword 'true' as enumeration constant" }
++/* { dg-message "'true' is a keyword with '-std=c23' onwards" "" { target *-*-* } .-1 } */
++/* { dg-error "38: expected ';', identifier or '\\\(' before '_Bool'" "" { target *-*-* } .-2 } */
++/* { dg-warning "38: useless type name in empty declaration" "" { target *-*-* } .-3 } */
+
+base-commit: 115e4bf54ec91a4f358a9e68dcd7a234b0ccc5b8
+-- 
+2.47.1
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 5fb36c9..aef08ee 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+30	??
+
+	+ 73_all_PR117629-c-special-case-some-bool-errors-with-C23.patch
+
 29	1 December 2024
 
 	- 72_all_PR111600-genemit-Distribute-evenly-to-files.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-08 22:41 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-08 22:41 UTC (permalink / raw
  To: gentoo-commits

commit:     b89362d1145e9068917132227255434586193837
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  8 22:41:08 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec  8 22:41:08 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=b89362d1

15.0.0: cut patchset 30

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index aef08ee..b42dfc7 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-30	??
+30	8 December 2024
 
 	+ 73_all_PR117629-c-special-case-some-bool-errors-with-C23.patch
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-09  3:05 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-09  3:05 UTC (permalink / raw
  To: gentoo-commits

commit:     c52e67271ce71be301691e491fd45d01b779e8fb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  9 03:04:45 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec  9 03:04:45 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c52e6727

15.0.0: add patches for C FAM ICEs w/ C23

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

 ...mpatibility-for-types-with-flexible-array.patch | 330 +++++++++++++++++++++
 ...724-testsuite-fix-LTO-flags-in-pr112716.c.patch |  27 ++
 15.0.0/gentoo/README.history                       |   5 +
 3 files changed, 362 insertions(+)

diff --git a/15.0.0/gentoo/74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch b/15.0.0/gentoo/74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
new file mode 100644
index 0000000..3c20493
--- /dev/null
+++ b/15.0.0/gentoo/74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
@@ -0,0 +1,330 @@
+From e1d3dfa0936ca5b50c87f6ddf5347fa401a703f6 Mon Sep 17 00:00:00 2001
+Message-ID: <e1d3dfa0936ca5b50c87f6ddf5347fa401a703f6.1733713329.git.sam@gentoo.org>
+From: Martin Uecker <uecker@tugraz.at>
+Date: Mon, 9 Dec 2024 00:11:58 +0100
+Subject: [PATCH 1/2] Fix type compatibility for types with flexible array
+ member [PR113688,PR114014,PR117724]
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Hi Richard,
+
+this is another version.  It now adds an "ignore_size" flag
+to gimple_canonical_types_compatible_p and uses this instead
+of having the complicated special case for arrays at the
+end.  Also zero-sized members are now ignored again, except
+if they are arrays at the end where then only the size is
+ignored.  This can still be stricter than before for the 
+case where there are zero-sized arrays at the end (e.g.
+before element type could differ).
+
+Martin
+
+Bootstrapped and regression tested on x86_64.
+
+Fix type compatibility for types with flexible array member [PR113688,PR114014,PR117724]
+
+    verify_type checks the compatibility of TYPE_CANONICAL using
+    gimple_canonical_types_compatible_p.   But it is stricter than what the
+    C standard requires and therefor inconsistent with how TYPE_CANONICAL is set
+    in the C FE.  Here, the logic is changed to ignore the array size when it
+    is the last element of a structure or union.  To not get errors because of
+    an inconsistent number of members, zero-sized arrays which are the last
+    element are not ignored anymore when checking the fields of a struct (which
+    in this particular case is stricter than what was done before).  Finally,
+    exceptions are added that allow the TYPE_MODE of a type with an array as
+    last member and of such arrays to differ from another compatible type.
+
+            PR c/112716
+            PR c/113688
+            PR c/114014
+            PR c/117724
+
+    gcc/ChangeLog:
+            * tree.cc (gimple_canonical_types_compatible_p): Add
+              `ignore_size' parameter and revise logic.
+            (verify_type): Add exceptions.
+
+    gcc/lto/ChangeLog:
+            * lto-common.cc (hash_canonical_type): Add exceptions.
+
+    gcc/testsuite/ChangeLog:
+            * gcc.dg/pr112716.c: New test.
+            * gcc.dg/pr113688.c: New test.
+            * gcc.dg/pr114014.c: New test.
+            * gcc.dg/pr117724.c: New test.
+---
+ gcc/lto/lto-common.cc           |  9 ++++--
+ gcc/testsuite/gcc.dg/pr112716.c | 40 +++++++++++++++++++++++++
+ gcc/testsuite/gcc.dg/pr113688.c |  8 +++++
+ gcc/testsuite/gcc.dg/pr114014.c | 14 +++++++++
+ gcc/testsuite/gcc.dg/pr117724.c | 16 ++++++++++
+ gcc/tree.cc                     | 53 +++++++++++++++++++++++++--------
+ gcc/tree.h                      |  3 +-
+ 7 files changed, 127 insertions(+), 16 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/pr112716.c
+ create mode 100644 gcc/testsuite/gcc.dg/pr113688.c
+ create mode 100644 gcc/testsuite/gcc.dg/pr114014.c
+ create mode 100644 gcc/testsuite/gcc.dg/pr117724.c
+
+diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
+index 86a309f92b40..f65a9d1c7b6f 100644
+--- a/gcc/lto/lto-common.cc
++++ b/gcc/lto/lto-common.cc
+@@ -254,7 +254,8 @@ hash_canonical_type (tree type)
+      checked.  */
+   code = tree_code_for_canonical_type_merging (TREE_CODE (type));
+   hstate.add_int (code);
+-  hstate.add_int (TYPE_MODE (type));
++  if (!RECORD_OR_UNION_TYPE_P (type))
++    hstate.add_int (TYPE_MODE (type));
+ 
+   /* Incorporate common features of numerical types.  */
+   if (INTEGRAL_TYPE_P (type)
+@@ -332,7 +333,11 @@ hash_canonical_type (tree type)
+ 	    && (! DECL_SIZE (f)
+ 		|| ! integer_zerop (DECL_SIZE (f))))
+ 	  {
+-	    iterative_hash_canonical_type (TREE_TYPE (f), hstate);
++	    tree t = TREE_TYPE (f);
++	    if (!TREE_CHAIN (f)
++		&& TREE_CODE (t) == ARRAY_TYPE)
++	      t = TREE_TYPE  (t);
++	    iterative_hash_canonical_type (t, hstate);
+ 	    nf++;
+ 	  }
+ 
+diff --git a/gcc/testsuite/gcc.dg/pr112716.c b/gcc/testsuite/gcc.dg/pr112716.c
+new file mode 100644
+index 000000000000..109dd252f0d6
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/pr112716.c
+@@ -0,0 +1,40 @@
++/* { dg-do compile } */
++/* { dg-options "-lfto -O2" } */
++
++#define T1 int[n]
++#define T2 int[n]
++
++// TU 1
++void bar(void*);
++
++[[gnu::noinline,gnu::noipa]]
++int foo(void *p, void *q)
++{
++	int n = 5;
++	struct foo { int x; typeof(T1) y; } *p2 = p;
++	p2->x = 1;
++	bar(q);
++	return p2->x;
++}
++
++int main()
++{
++	int n = 5;
++	void *p = __builtin_malloc(sizeof(struct foo { int x; typeof(T1) y; }));
++
++	if (!p)
++		return 0;
++
++	if (2 != foo(p, p))
++		__builtin_abort();
++
++	return 0;
++}
++// TU 2
++void bar(void* q)
++{
++	int n = 5;
++	struct foo { int x; typeof(T2) y; } *q2 = q;
++	q2->x = 2;
++}
++
+diff --git a/gcc/testsuite/gcc.dg/pr113688.c b/gcc/testsuite/gcc.dg/pr113688.c
+new file mode 100644
+index 000000000000..8dee8c86f1bf
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/pr113688.c
+@@ -0,0 +1,8 @@
++/* { dg-do compile } */
++/* { dg-options "-g" } */
++
++struct S{int x,y[1];}*a;
++int main(void){
++	struct S{int x,y[];};
++}
++
+diff --git a/gcc/testsuite/gcc.dg/pr114014.c b/gcc/testsuite/gcc.dg/pr114014.c
+new file mode 100644
+index 000000000000..1531ffab1b75
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/pr114014.c
+@@ -0,0 +1,14 @@
++/* PR c/114014
++ * { dg-do compile }
++ * { dg-options "-std=gnu23 -g" } */
++
++struct r {
++  int a;
++  char b[];
++};
++struct r {
++  int a;
++  char b[0];
++};
++
++
+diff --git a/gcc/testsuite/gcc.dg/pr117724.c b/gcc/testsuite/gcc.dg/pr117724.c
+new file mode 100644
+index 000000000000..d631daeb644d
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/pr117724.c
+@@ -0,0 +1,16 @@
++/* { dg-do compile } */
++/* { dg-options "-g" } */
++
++struct {
++  unsigned long len;
++  unsigned long size;
++  char data[];
++};			/* { dg-warning "unnamed struct" } */
++struct {
++  struct {
++    unsigned long len;
++    unsigned long size;
++    char data[6];
++  };
++};			/* { dg-warning "unnamed struct" } */
++
+diff --git a/gcc/tree.cc b/gcc/tree.cc
+index 83a03374a325..da4b7f5daa8c 100644
+--- a/gcc/tree.cc
++++ b/gcc/tree.cc
+@@ -13837,11 +13837,13 @@ type_with_interoperable_signedness (const_tree type)
+    verifier.  If TRUST_TYPE_CANONICAL we do not look into structure of types
+    that have TYPE_CANONICAL defined and assume them equivalent.  This is useful
+    only for LTO because only in these cases TYPE_CANONICAL equivalence
+-   correspond to one defined by gimple_canonical_types_compatible_p.  */
+-
++   correspond to one defined by gimple_canonical_types_compatible_p.
++   If IGNORE_SIZE, we allow a mismatch of the mode and the number of
++   elements for arrays.  */
+ bool
+ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
+-				     bool trust_type_canonical)
++				     bool trust_type_canonical,
++				     bool ignore_size)
+ {
+   /* Type variants should be same as the main variant.  When not doing sanity
+      checking to verify this fact, go to main variants and save some work.  */
+@@ -13914,8 +13916,12 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
+       || TREE_CODE (t1) == NULLPTR_TYPE)
+     return true;
+ 
+-  /* Can't be the same type if they have different mode.  */
+-  if (TYPE_MODE (t1) != TYPE_MODE (t2))
++  /* Can't be compatible types if they have different mode.  Because of
++     flexible array members, we allow mismatching modes for structures or
++     unions and for arrays when we ignore the size.  */
++  if (!RECORD_OR_UNION_TYPE_P (t1)
++      && (!ignore_size || TREE_CODE (t1) != ARRAY_TYPE)
++      && (TYPE_MODE (t1) != TYPE_MODE (t2)))
+     return false;
+ 
+   /* Non-aggregate types can be handled cheaply.  */
+@@ -13966,15 +13972,19 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
+     {
+     case ARRAY_TYPE:
+       /* Array types are the same if the element types are the same and
+-	 the number of elements are the same.  */
++	 minimum and maximum index are the same.  */
+       if (!gimple_canonical_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2),
+-						trust_type_canonical)
++						trust_type_canonical,
++						ignore_size)
+ 	  || TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2)
+ 	  || TYPE_REVERSE_STORAGE_ORDER (t1) != TYPE_REVERSE_STORAGE_ORDER (t2)
+ 	  || TYPE_NONALIASED_COMPONENT (t1) != TYPE_NONALIASED_COMPONENT (t2))
+ 	return false;
+       else
+ 	{
++	  if (ignore_size)
++	    return true;
++
+ 	  tree i1 = TYPE_DOMAIN (t1);
+ 	  tree i2 = TYPE_DOMAIN (t2);
+ 
+@@ -14060,23 +14070,36 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
+ 	     f1 || f2;
+ 	     f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2))
+ 	  {
+-	    /* Skip non-fields and zero-sized fields.  */
++	    /* Skip non-fields and zero-sized fields, except zero-sized
++	       arrays at the end.  */
+ 	    while (f1 && (TREE_CODE (f1) != FIELD_DECL
+ 			  || (DECL_SIZE (f1)
+-			      && integer_zerop (DECL_SIZE (f1)))))
++			      && integer_zerop (DECL_SIZE (f1))
++			      && (TREE_CHAIN (f1)
++				  || TREE_CODE (TREE_TYPE (f1))
++				     != ARRAY_TYPE))))
+ 	      f1 = TREE_CHAIN (f1);
+ 	    while (f2 && (TREE_CODE (f2) != FIELD_DECL
+ 			  || (DECL_SIZE (f2)
+-			      && integer_zerop (DECL_SIZE (f2)))))
++			      && integer_zerop (DECL_SIZE (f2))
++			      && (TREE_CHAIN (f2)
++				  || TREE_CODE (TREE_TYPE (f2))
++				     != ARRAY_TYPE))))
+ 	      f2 = TREE_CHAIN (f2);
+ 	    if (!f1 || !f2)
+ 	      break;
+-	    /* The fields must have the same name, offset and type.  */
++
++	    tree t1 = TREE_TYPE (f1);
++	    tree t2 = TREE_TYPE (f2);
++
++	    /* If the last element is an array, we allow a mismatch in size. */
++	    bool ignore_size = (TREE_CHAIN (f1) == NULL_TREE
++				&& TREE_CODE (t1) == ARRAY_TYPE);
++
+ 	    if (DECL_NONADDRESSABLE_P (f1) != DECL_NONADDRESSABLE_P (f2)
+ 		|| !gimple_compare_field_offset (f1, f2)
+ 		|| !gimple_canonical_types_compatible_p
+-		      (TREE_TYPE (f1), TREE_TYPE (f2),
+-		       trust_type_canonical))
++		      (t1, t2, trust_type_canonical, ignore_size))
+ 	      return false;
+ 	  }
+ 
+@@ -14220,6 +14243,10 @@ verify_type (const_tree t)
+     }
+ 
+   if (COMPLETE_TYPE_P (t) && TYPE_CANONICAL (t)
++      /* We allow a mismatch for structure or union because of
++	 flexible array members.  */
++      && !RECORD_OR_UNION_TYPE_P (t)
++      && !RECORD_OR_UNION_TYPE_P (TYPE_CANONICAL (t))
+       && TYPE_MODE (t) != TYPE_MODE (TYPE_CANONICAL (t)))
+     {
+       error ("%<TYPE_MODE%> of %<TYPE_CANONICAL%> is not compatible");
+diff --git a/gcc/tree.h b/gcc/tree.h
+index 75054839d9b6..6608754a3e20 100644
+--- a/gcc/tree.h
++++ b/gcc/tree.h
+@@ -5844,7 +5844,8 @@ extern unsigned int tree_map_base_hash (const void *);
+ extern bool tree_map_base_marked_p (const void *);
+ extern void DEBUG_FUNCTION verify_type (const_tree t);
+ extern bool gimple_canonical_types_compatible_p (const_tree, const_tree,
+-						 bool trust_type_canonical = true);
++						 bool trust_type_canonical = true,
++						 bool ignore_size = false);
+ extern bool type_with_interoperable_signedness (const_tree);
+ extern bitmap get_nonnull_args (const_tree);
+ extern int get_range_pos_neg (tree);
+
+base-commit: 6205144d6b566f32a58c4fa4f5e7e2343ad07c62
+-- 
+2.47.1
+

diff --git a/15.0.0/gentoo/75_all_PR117724-testsuite-fix-LTO-flags-in-pr112716.c.patch b/15.0.0/gentoo/75_all_PR117724-testsuite-fix-LTO-flags-in-pr112716.c.patch
new file mode 100644
index 0000000..f36840e
--- /dev/null
+++ b/15.0.0/gentoo/75_all_PR117724-testsuite-fix-LTO-flags-in-pr112716.c.patch
@@ -0,0 +1,27 @@
+From 2f961c392ab359286ef1350d37e50e7841773d7b Mon Sep 17 00:00:00 2001
+Message-ID: <2f961c392ab359286ef1350d37e50e7841773d7b.1733713329.git.sam@gentoo.org>
+In-Reply-To: <e1d3dfa0936ca5b50c87f6ddf5347fa401a703f6.1733713329.git.sam@gentoo.org>
+References: <e1d3dfa0936ca5b50c87f6ddf5347fa401a703f6.1733713329.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Mon, 9 Dec 2024 03:01:47 +0000
+Subject: [PATCH 2/2] testsuite: fix LTO flags in pr112716.c
+
+---
+ gcc/testsuite/gcc.dg/pr112716.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/testsuite/gcc.dg/pr112716.c b/gcc/testsuite/gcc.dg/pr112716.c
+index 109dd252f0d6..873eedaafd18 100644
+--- a/gcc/testsuite/gcc.dg/pr112716.c
++++ b/gcc/testsuite/gcc.dg/pr112716.c
+@@ -1,5 +1,6 @@
+ /* { dg-do compile } */
+-/* { dg-options "-lfto -O2" } */
++/* { dg-options "-flto -O2" } */
++/* { dg-require-effective-target lto } */
+ 
+ #define T1 int[n]
+ #define T2 int[n]
+-- 
+2.47.1
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index b42dfc7..048d96a 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,8 @@
+31	???
+
+	+ 74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
+	+ 75_all_PR117724-testsuite-fix-LTO-flags-in-pr112716.c.patch
+
 30	8 December 2024
 
 	+ 73_all_PR117629-c-special-case-some-bool-errors-with-C23.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-10  5:07 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-10  5:07 UTC (permalink / raw
  To: gentoo-commits

commit:     35045208b613bd86d21415331da51d235ee5e6e7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 10 05:07:05 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 10 05:07:05 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=35045208

15.0.0: add nvptx bashism patch

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

 ...tx-fix-bashisms-with-gen-copyright.sh-use.patch | 68 ++++++++++++++++++++++
 15.0.0/gentoo/README.history                       |  1 +
 2 files changed, 69 insertions(+)

diff --git a/15.0.0/gentoo/76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch b/15.0.0/gentoo/76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch
new file mode 100644
index 0000000..6011313
--- /dev/null
+++ b/15.0.0/gentoo/76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch
@@ -0,0 +1,68 @@
+From f6959883aecd1500698ea969de631ffa010ce833 Mon Sep 17 00:00:00 2001
+Message-ID: <f6959883aecd1500698ea969de631ffa010ce833.1733807152.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Fri, 6 Dec 2024 09:11:11 +0000
+Subject: [PATCH] config: nvptx: fix bashisms with gen-copyright.sh use
+
+Providing parameters to `.` when sourcing is a bashism and not supported
+by POSIX shell which causes a build failure when compiling a toolchain
+for nvptx-none with dash as /bin/sh.
+
+gen-copyright.sh takes a parameter for the format of copyright notice
+required. Switch that to using an environment variable `NVPTX_GEN_COPYRIGHT`,
+although this could be changed to a function if desired (just more churn
+in gen-copyright.sh then).
+
+gcc/ChangeLog:
+	PR target/117854
+
+	* config/nvptx/gen-copyright.sh: Read NVPTX_GEN_COPYRIGHT envvar.
+	* config/nvptx/gen-h.sh: Set NVPTX_GEN_COPYRIGHT.
+	* config/nvptx/gen-opt.sh: Ditto.
+---
+ gcc/config/nvptx/gen-copyright.sh | 2 +-
+ gcc/config/nvptx/gen-h.sh         | 2 +-
+ gcc/config/nvptx/gen-opt.sh       | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/gcc/config/nvptx/gen-copyright.sh b/gcc/config/nvptx/gen-copyright.sh
+index d0a86acb832c..b140de0eb76d 100644
+--- a/gcc/config/nvptx/gen-copyright.sh
++++ b/gcc/config/nvptx/gen-copyright.sh
+@@ -18,7 +18,7 @@
+ # along with GCC; see the file COPYING3.  If not see
+ # <http://www.gnu.org/licenses/>.
+ 
+-style="$1"
++style="${1:-${NVPTX_GEN_COPYRIGHT}}"
+ case $style in
+     opt)
+     ;;
+diff --git a/gcc/config/nvptx/gen-h.sh b/gcc/config/nvptx/gen-h.sh
+index bc4ce9af1e2a..a5c18d864504 100644
+--- a/gcc/config/nvptx/gen-h.sh
++++ b/gcc/config/nvptx/gen-h.sh
+@@ -36,7 +36,7 @@ EOF
+ # Separator.
+ echo
+ 
+-. $gen_copyright_sh c
++NVPTX_GEN_COPYRIGHT=c . $gen_copyright_sh
+ 
+ # Separator.
+ echo
+diff --git a/gcc/config/nvptx/gen-opt.sh b/gcc/config/nvptx/gen-opt.sh
+index 103bcddc02b5..40c949425f27 100644
+--- a/gcc/config/nvptx/gen-opt.sh
++++ b/gcc/config/nvptx/gen-opt.sh
+@@ -40,7 +40,7 @@ EOF
+ # Separator.
+ echo
+ 
+-. $gen_copyright_sh opt
++NVPTX_GEN_COPYRIGHT=opt . $gen_copyright_sh
+ 
+ # Not emitting the following here (in addition to having it in 'nvptx.opt'), as
+ # we'll otherwise run into:
+-- 
+2.47.1

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 048d96a..adc1fef 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -2,6 +2,7 @@
 
 	+ 74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
 	+ 75_all_PR117724-testsuite-fix-LTO-flags-in-pr112716.c.patch
+	+ 76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch
 
 30	8 December 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-10  5:11 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-10  5:11 UTC (permalink / raw
  To: gentoo-commits

commit:     f41e17d0b106cc664c051f599c09ce696a3ab66d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 10 05:11:17 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 10 05:11:17 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f41e17d0

15.0.0: update -fstack-clash-protection patch for offload

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

 15.0.0/gentoo/24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch | 2 +-
 15.0.0/gentoo/README.history                                      | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch b/15.0.0/gentoo/24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
index b13215d..b2cc852 100644
--- a/15.0.0/gentoo/24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
+++ b/15.0.0/gentoo/24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
@@ -19,7 +19,7 @@ We add -fstack-clash-protection if requested
  
 +/* Default value for flag_clash_protector when flag_clash_protector is
 +   initialized to -1.  */
-+#ifdef DEF_GENTOO_SCP
++#if defined(DEF_GENTOO_SCP) && !defined(ACCEL_COMPILER)
 +#define DEFAULT_FLAG_SCP 1
 +#endif
 +#ifndef DEFAULT_FLAG_SCP

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index adc1fef..63fd877 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,5 +1,6 @@
 31	???
 
+	U 24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
 	+ 74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
 	+ 75_all_PR117724-testsuite-fix-LTO-flags-in-pr112716.c.patch
 	+ 76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-10  5:13 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-10  5:13 UTC (permalink / raw
  To: gentoo-commits

commit:     ec76a392e824bb1abe5f2d390d4bdbd96ee50040
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 10 05:12:51 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 10 05:13:01 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=ec76a392

15.0.0: update -D_GLIBCXX_ASSERTIONS patch for offload

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

 15.0.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch b/15.0.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch
index 2daf73b..8e9e19b 100644
--- a/15.0.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch
+++ b/15.0.0/gentoo/15_all_DEF_GENTOO_GLIBCXX_ASSERTIONS.patch
@@ -5,7 +5,7 @@ https://bugs.gentoo.org/876895
  	  cpp_define (pfile, "__cpp_rtti=199711L");
  	}
  
-+      #ifdef DEF_GENTOO_GLIBCXX_ASSERTIONS
++      #if defined(DEF_GENTOO_GLIBCXX_ASSERTIONS) && !defined(ACCEL_COMPILER)
 +	  cpp_define (pfile, "_GLIBCXX_ASSERTIONS");
 +      #endif
 +


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-10  5:19 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-10  5:19 UTC (permalink / raw
  To: gentoo-commits

commit:     95a0fb3364df529328991a746a47ea9bd3ef4e23
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 10 05:18:49 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 10 05:19:16 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=95a0fb33

15.0.0: update -fcf-protection patch for offload

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

 15.0.0/gentoo/26_all_enable-cet.patch | 2 +-
 15.0.0/gentoo/README.history          | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/26_all_enable-cet.patch b/15.0.0/gentoo/26_all_enable-cet.patch
index be772d0..6d977cf 100644
--- a/15.0.0/gentoo/26_all_enable-cet.patch
+++ b/15.0.0/gentoo/26_all_enable-cet.patch
@@ -67,7 +67,7 @@ Only supported on amd64.
 +
 +   We use a new option (EXTRA_OPTIONS_CF) here to avoid turning
 +   this on accidentally for other arches. */
-+#ifdef EXTRA_OPTIONS_CF
++#if defined(EXTRA_OPTIONS_CF) && !defined(ACCEL_COMPILER)
 +#define DEFAULT_FLAG_CF_SPEC " %{!m16:%{!m32:%{!fcf-protection*:%{!fno-cf-protection:-fcf-protection}}}} -foffload-options=-fcf-protection=none"
 +#endif
 +#ifndef DEFAULT_FLAG_CF_SPEC

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 63fd877..639981b 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,6 +1,7 @@
 31	???
 
 	U 24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
+	U 26_all_enable-cet.patch
 	+ 74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
 	+ 75_all_PR117724-testsuite-fix-LTO-flags-in-pr112716.c.patch
 	+ 76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-10 14:55 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-10 14:55 UTC (permalink / raw
  To: gentoo-commits

commit:     236e7b39fc0545df14b4df5e45d37c1b844ddc23
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 10 14:55:15 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 10 14:55:42 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=236e7b39

15.0.0: update C23 FAM patches

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

 ...mpatibility-for-types-with-flexible-array.patch | 304 ++-------------------
 ...atibility-for-types-with-flexible-array-2.patch | 250 +++++++++++++++++
 ...724-testsuite-fix-LTO-flags-in-pr112716.c.patch |  27 --
 15.0.0/gentoo/README.history                       |   2 +-
 4 files changed, 278 insertions(+), 305 deletions(-)

diff --git a/15.0.0/gentoo/74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch b/15.0.0/gentoo/74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
index 3c20493..1b682ad 100644
--- a/15.0.0/gentoo/74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
+++ b/15.0.0/gentoo/74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
@@ -1,75 +1,35 @@
-From e1d3dfa0936ca5b50c87f6ddf5347fa401a703f6 Mon Sep 17 00:00:00 2001
-Message-ID: <e1d3dfa0936ca5b50c87f6ddf5347fa401a703f6.1733713329.git.sam@gentoo.org>
+From 511aac7c85e6cc2ce474e1169dadd17c570743ec Mon Sep 17 00:00:00 2001
+Message-ID: <511aac7c85e6cc2ce474e1169dadd17c570743ec.1733842378.git.sam@gentoo.org>
 From: Martin Uecker <uecker@tugraz.at>
-Date: Mon, 9 Dec 2024 00:11:58 +0100
+Date: Tue, 10 Dec 2024 13:29:27 +0100
 Subject: [PATCH 1/2] Fix type compatibility for types with flexible array
- member [PR113688,PR114014,PR117724]
+ member [PR113688,PR114713,PR117724]
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
 
-Hi Richard,
-
-this is another version.  It now adds an "ignore_size" flag
-to gimple_canonical_types_compatible_p and uses this instead
-of having the complicated special case for arrays at the
-end.  Also zero-sized members are now ignored again, except
-if they are arrays at the end where then only the size is
-ignored.  This can still be stricter than before for the 
-case where there are zero-sized arrays at the end (e.g.
-before element type could differ).
-
-Martin
+As requested, I split up into one part for the TYPE_MODE and 
+another one for the array size to help with git bisecting.  This
+is the first part.
 
 Bootstrapped and regression tested on x86_64.
 
-Fix type compatibility for types with flexible array member [PR113688,PR114014,PR117724]
-
-    verify_type checks the compatibility of TYPE_CANONICAL using
-    gimple_canonical_types_compatible_p.   But it is stricter than what the
-    C standard requires and therefor inconsistent with how TYPE_CANONICAL is set
-    in the C FE.  Here, the logic is changed to ignore the array size when it
-    is the last element of a structure or union.  To not get errors because of
-    an inconsistent number of members, zero-sized arrays which are the last
-    element are not ignored anymore when checking the fields of a struct (which
-    in this particular case is stricter than what was done before).  Finally,
-    exceptions are added that allow the TYPE_MODE of a type with an array as
-    last member and of such arrays to differ from another compatible type.
+Allow the TYPE_MODE of a type with an array as last member to differ from
+another compatible type.
 
-            PR c/112716
-            PR c/113688
-            PR c/114014
-            PR c/117724
+gcc/ChangeLog:
+        * tree.cc (gimple_canonical_types_compatible_p): Add exception.
+        (verify_type): Add exception.
 
-    gcc/ChangeLog:
-            * tree.cc (gimple_canonical_types_compatible_p): Add
-              `ignore_size' parameter and revise logic.
-            (verify_type): Add exceptions.
-
-    gcc/lto/ChangeLog:
-            * lto-common.cc (hash_canonical_type): Add exceptions.
-
-    gcc/testsuite/ChangeLog:
-            * gcc.dg/pr112716.c: New test.
-            * gcc.dg/pr113688.c: New test.
-            * gcc.dg/pr114014.c: New test.
-            * gcc.dg/pr117724.c: New test.
+gcc/lto/ChangeLog:
+        * lto-common.cc (hash_canonical_type): Add exception.
 ---
- gcc/lto/lto-common.cc           |  9 ++++--
- gcc/testsuite/gcc.dg/pr112716.c | 40 +++++++++++++++++++++++++
- gcc/testsuite/gcc.dg/pr113688.c |  8 +++++
- gcc/testsuite/gcc.dg/pr114014.c | 14 +++++++++
- gcc/testsuite/gcc.dg/pr117724.c | 16 ++++++++++
- gcc/tree.cc                     | 53 +++++++++++++++++++++++++--------
- gcc/tree.h                      |  3 +-
- 7 files changed, 127 insertions(+), 16 deletions(-)
- create mode 100644 gcc/testsuite/gcc.dg/pr112716.c
- create mode 100644 gcc/testsuite/gcc.dg/pr113688.c
- create mode 100644 gcc/testsuite/gcc.dg/pr114014.c
- create mode 100644 gcc/testsuite/gcc.dg/pr117724.c
+ gcc/lto/lto-common.cc |  3 ++-
+ gcc/tree.cc           | 12 +++++++++---
+ 2 files changed, 11 insertions(+), 4 deletions(-)
 
 diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
-index 86a309f92b40..f65a9d1c7b6f 100644
+index 86a309f92b40..940502099128 100644
 --- a/gcc/lto/lto-common.cc
 +++ b/gcc/lto/lto-common.cc
 @@ -254,7 +254,8 @@ hash_canonical_type (tree type)
@@ -82,143 +42,11 @@ index 86a309f92b40..f65a9d1c7b6f 100644
  
    /* Incorporate common features of numerical types.  */
    if (INTEGRAL_TYPE_P (type)
-@@ -332,7 +333,11 @@ hash_canonical_type (tree type)
- 	    && (! DECL_SIZE (f)
- 		|| ! integer_zerop (DECL_SIZE (f))))
- 	  {
--	    iterative_hash_canonical_type (TREE_TYPE (f), hstate);
-+	    tree t = TREE_TYPE (f);
-+	    if (!TREE_CHAIN (f)
-+		&& TREE_CODE (t) == ARRAY_TYPE)
-+	      t = TREE_TYPE  (t);
-+	    iterative_hash_canonical_type (t, hstate);
- 	    nf++;
- 	  }
- 
-diff --git a/gcc/testsuite/gcc.dg/pr112716.c b/gcc/testsuite/gcc.dg/pr112716.c
-new file mode 100644
-index 000000000000..109dd252f0d6
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/pr112716.c
-@@ -0,0 +1,40 @@
-+/* { dg-do compile } */
-+/* { dg-options "-lfto -O2" } */
-+
-+#define T1 int[n]
-+#define T2 int[n]
-+
-+// TU 1
-+void bar(void*);
-+
-+[[gnu::noinline,gnu::noipa]]
-+int foo(void *p, void *q)
-+{
-+	int n = 5;
-+	struct foo { int x; typeof(T1) y; } *p2 = p;
-+	p2->x = 1;
-+	bar(q);
-+	return p2->x;
-+}
-+
-+int main()
-+{
-+	int n = 5;
-+	void *p = __builtin_malloc(sizeof(struct foo { int x; typeof(T1) y; }));
-+
-+	if (!p)
-+		return 0;
-+
-+	if (2 != foo(p, p))
-+		__builtin_abort();
-+
-+	return 0;
-+}
-+// TU 2
-+void bar(void* q)
-+{
-+	int n = 5;
-+	struct foo { int x; typeof(T2) y; } *q2 = q;
-+	q2->x = 2;
-+}
-+
-diff --git a/gcc/testsuite/gcc.dg/pr113688.c b/gcc/testsuite/gcc.dg/pr113688.c
-new file mode 100644
-index 000000000000..8dee8c86f1bf
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/pr113688.c
-@@ -0,0 +1,8 @@
-+/* { dg-do compile } */
-+/* { dg-options "-g" } */
-+
-+struct S{int x,y[1];}*a;
-+int main(void){
-+	struct S{int x,y[];};
-+}
-+
-diff --git a/gcc/testsuite/gcc.dg/pr114014.c b/gcc/testsuite/gcc.dg/pr114014.c
-new file mode 100644
-index 000000000000..1531ffab1b75
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/pr114014.c
-@@ -0,0 +1,14 @@
-+/* PR c/114014
-+ * { dg-do compile }
-+ * { dg-options "-std=gnu23 -g" } */
-+
-+struct r {
-+  int a;
-+  char b[];
-+};
-+struct r {
-+  int a;
-+  char b[0];
-+};
-+
-+
-diff --git a/gcc/testsuite/gcc.dg/pr117724.c b/gcc/testsuite/gcc.dg/pr117724.c
-new file mode 100644
-index 000000000000..d631daeb644d
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/pr117724.c
-@@ -0,0 +1,16 @@
-+/* { dg-do compile } */
-+/* { dg-options "-g" } */
-+
-+struct {
-+  unsigned long len;
-+  unsigned long size;
-+  char data[];
-+};			/* { dg-warning "unnamed struct" } */
-+struct {
-+  struct {
-+    unsigned long len;
-+    unsigned long size;
-+    char data[6];
-+  };
-+};			/* { dg-warning "unnamed struct" } */
-+
 diff --git a/gcc/tree.cc b/gcc/tree.cc
-index 83a03374a325..da4b7f5daa8c 100644
+index 83a03374a325..1391af6bd4c3 100644
 --- a/gcc/tree.cc
 +++ b/gcc/tree.cc
-@@ -13837,11 +13837,13 @@ type_with_interoperable_signedness (const_tree type)
-    verifier.  If TRUST_TYPE_CANONICAL we do not look into structure of types
-    that have TYPE_CANONICAL defined and assume them equivalent.  This is useful
-    only for LTO because only in these cases TYPE_CANONICAL equivalence
--   correspond to one defined by gimple_canonical_types_compatible_p.  */
--
-+   correspond to one defined by gimple_canonical_types_compatible_p.
-+   If IGNORE_SIZE, we allow a mismatch of the mode and the number of
-+   elements for arrays.  */
- bool
- gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
--				     bool trust_type_canonical)
-+				     bool trust_type_canonical,
-+				     bool ignore_size)
- {
-   /* Type variants should be same as the main variant.  When not doing sanity
-      checking to verify this fact, go to main variants and save some work.  */
-@@ -13914,8 +13916,12 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
+@@ -13914,8 +13914,11 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
        || TREE_CODE (t1) == NULLPTR_TYPE)
      return true;
  
@@ -226,81 +54,17 @@ index 83a03374a325..da4b7f5daa8c 100644
 -  if (TYPE_MODE (t1) != TYPE_MODE (t2))
 +  /* Can't be compatible types if they have different mode.  Because of
 +     flexible array members, we allow mismatching modes for structures or
-+     unions and for arrays when we ignore the size.  */
++     unions.  */
 +  if (!RECORD_OR_UNION_TYPE_P (t1)
-+      && (!ignore_size || TREE_CODE (t1) != ARRAY_TYPE)
-+      && (TYPE_MODE (t1) != TYPE_MODE (t2)))
++      && TYPE_MODE (t1) != TYPE_MODE (t2))
      return false;
  
    /* Non-aggregate types can be handled cheaply.  */
-@@ -13966,15 +13972,19 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
-     {
-     case ARRAY_TYPE:
-       /* Array types are the same if the element types are the same and
--	 the number of elements are the same.  */
-+	 minimum and maximum index are the same.  */
-       if (!gimple_canonical_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2),
--						trust_type_canonical)
-+						trust_type_canonical,
-+						ignore_size)
- 	  || TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2)
- 	  || TYPE_REVERSE_STORAGE_ORDER (t1) != TYPE_REVERSE_STORAGE_ORDER (t2)
- 	  || TYPE_NONALIASED_COMPONENT (t1) != TYPE_NONALIASED_COMPONENT (t2))
- 	return false;
-       else
- 	{
-+	  if (ignore_size)
-+	    return true;
-+
- 	  tree i1 = TYPE_DOMAIN (t1);
- 	  tree i2 = TYPE_DOMAIN (t2);
- 
-@@ -14060,23 +14070,36 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
- 	     f1 || f2;
- 	     f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2))
- 	  {
--	    /* Skip non-fields and zero-sized fields.  */
-+	    /* Skip non-fields and zero-sized fields, except zero-sized
-+	       arrays at the end.  */
- 	    while (f1 && (TREE_CODE (f1) != FIELD_DECL
- 			  || (DECL_SIZE (f1)
--			      && integer_zerop (DECL_SIZE (f1)))))
-+			      && integer_zerop (DECL_SIZE (f1))
-+			      && (TREE_CHAIN (f1)
-+				  || TREE_CODE (TREE_TYPE (f1))
-+				     != ARRAY_TYPE))))
- 	      f1 = TREE_CHAIN (f1);
- 	    while (f2 && (TREE_CODE (f2) != FIELD_DECL
- 			  || (DECL_SIZE (f2)
--			      && integer_zerop (DECL_SIZE (f2)))))
-+			      && integer_zerop (DECL_SIZE (f2))
-+			      && (TREE_CHAIN (f2)
-+				  || TREE_CODE (TREE_TYPE (f2))
-+				     != ARRAY_TYPE))))
- 	      f2 = TREE_CHAIN (f2);
- 	    if (!f1 || !f2)
- 	      break;
--	    /* The fields must have the same name, offset and type.  */
-+
-+	    tree t1 = TREE_TYPE (f1);
-+	    tree t2 = TREE_TYPE (f2);
-+
-+	    /* If the last element is an array, we allow a mismatch in size. */
-+	    bool ignore_size = (TREE_CHAIN (f1) == NULL_TREE
-+				&& TREE_CODE (t1) == ARRAY_TYPE);
-+
- 	    if (DECL_NONADDRESSABLE_P (f1) != DECL_NONADDRESSABLE_P (f2)
- 		|| !gimple_compare_field_offset (f1, f2)
- 		|| !gimple_canonical_types_compatible_p
--		      (TREE_TYPE (f1), TREE_TYPE (f2),
--		       trust_type_canonical))
-+		      (t1, t2, trust_type_canonical, ignore_size))
- 	      return false;
- 	  }
- 
-@@ -14220,6 +14243,10 @@ verify_type (const_tree t)
+@@ -14218,8 +14221,11 @@ verify_type (const_tree t)
+       debug_tree (ct);
+       error_found = true;
      }
- 
+-
    if (COMPLETE_TYPE_P (t) && TYPE_CANONICAL (t)
 +      /* We allow a mismatch for structure or union because of
 +	 flexible array members.  */
@@ -309,22 +73,8 @@ index 83a03374a325..da4b7f5daa8c 100644
        && TYPE_MODE (t) != TYPE_MODE (TYPE_CANONICAL (t)))
      {
        error ("%<TYPE_MODE%> of %<TYPE_CANONICAL%> is not compatible");
-diff --git a/gcc/tree.h b/gcc/tree.h
-index 75054839d9b6..6608754a3e20 100644
---- a/gcc/tree.h
-+++ b/gcc/tree.h
-@@ -5844,7 +5844,8 @@ extern unsigned int tree_map_base_hash (const void *);
- extern bool tree_map_base_marked_p (const void *);
- extern void DEBUG_FUNCTION verify_type (const_tree t);
- extern bool gimple_canonical_types_compatible_p (const_tree, const_tree,
--						 bool trust_type_canonical = true);
-+						 bool trust_type_canonical = true,
-+						 bool ignore_size = false);
- extern bool type_with_interoperable_signedness (const_tree);
- extern bitmap get_nonnull_args (const_tree);
- extern int get_range_pos_neg (tree);
 
-base-commit: 6205144d6b566f32a58c4fa4f5e7e2343ad07c62
+base-commit: 34dfb30ca8dba6bc184e563b0ddc26a5239294e3
 -- 
 2.47.1
 

diff --git a/15.0.0/gentoo/75_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array-2.patch b/15.0.0/gentoo/75_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array-2.patch
new file mode 100644
index 0000000..1f35b83
--- /dev/null
+++ b/15.0.0/gentoo/75_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array-2.patch
@@ -0,0 +1,250 @@
+From 4bc7c98e86392a36f75029eabbe096d1bf9e85b5 Mon Sep 17 00:00:00 2001
+Message-ID: <4bc7c98e86392a36f75029eabbe096d1bf9e85b5.1733842378.git.sam@gentoo.org>
+In-Reply-To: <511aac7c85e6cc2ce474e1169dadd17c570743ec.1733842378.git.sam@gentoo.org>
+References: <511aac7c85e6cc2ce474e1169dadd17c570743ec.1733842378.git.sam@gentoo.org>
+From: Martin Uecker <uecker@tugraz.at>
+Date: Tue, 10 Dec 2024 13:31:50 +0100
+Subject: [PATCH 2/2] Fix type compatibility for types with flexible array
+ member [PR113688,PR114713,PR117724]
+
+The second part now only contains the changes for array size.
+
+I added back a special case for this instead of having the
+'ignore_size' flag (which I would nevertheless assume might be
+needed in the future when matching pointer types).
+
+In this version, I added an exception to the special case to ignore
+the case were both are zero-sized arrays, because this seems to be
+the only case were the new code would otherwise be stricter than the
+old code.
+
+I also replaced/fixed one test where I accidentally included a similar
+test for another closely related bug involving VLA types.
+
+Bootstrapped and regression tested on x86_64.
+
+For checking or computing TYPE_CANONICAL, ignore the array size when it is
+the last element of a structure or union.  To not get errors because of
+an inconsistent number of members, zero-sized arrays which are the last
+element are not ignored anymore when checking the fields of a struct.
+
+	PR c/113688
+	PR c/114014
+	PR c/114713
+	PR c/117724
+
+gcc/ChangeLog:
+	* tree.cc (gimple_canonical_types_compatible_p): Add exception.
+
+gcc/lto/ChangeLog:
+	* lto-common.cc (hash_canonical_type): Add exception.
+
+gcc/testsuite/ChangeLog:
+	* gcc.dg/pr113688.c: New test.
+	* gcc.dg/pr114014.c: New test.
+	* gcc.dg/pr114713.c: New test.
+	* gcc.dg/pr117724.c: New test.
+---
+ gcc/lto/lto-common.cc           |  6 +++++-
+ gcc/testsuite/gcc.dg/pr113688.c |  8 +++++++
+ gcc/testsuite/gcc.dg/pr114014.c | 14 ++++++++++++
+ gcc/testsuite/gcc.dg/pr114713.c | 35 ++++++++++++++++++++++++++++++
+ gcc/testsuite/gcc.dg/pr117724.c | 16 ++++++++++++++
+ gcc/tree.cc                     | 38 ++++++++++++++++++++++++++-------
+ 6 files changed, 108 insertions(+), 9 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/pr113688.c
+ create mode 100644 gcc/testsuite/gcc.dg/pr114014.c
+ create mode 100644 gcc/testsuite/gcc.dg/pr114713.c
+ create mode 100644 gcc/testsuite/gcc.dg/pr117724.c
+
+diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
+index 940502099128..f65a9d1c7b6f 100644
+--- a/gcc/lto/lto-common.cc
++++ b/gcc/lto/lto-common.cc
+@@ -333,7 +333,11 @@ hash_canonical_type (tree type)
+ 	    && (! DECL_SIZE (f)
+ 		|| ! integer_zerop (DECL_SIZE (f))))
+ 	  {
+-	    iterative_hash_canonical_type (TREE_TYPE (f), hstate);
++	    tree t = TREE_TYPE (f);
++	    if (!TREE_CHAIN (f)
++		&& TREE_CODE (t) == ARRAY_TYPE)
++	      t = TREE_TYPE  (t);
++	    iterative_hash_canonical_type (t, hstate);
+ 	    nf++;
+ 	  }
+ 
+diff --git a/gcc/testsuite/gcc.dg/pr113688.c b/gcc/testsuite/gcc.dg/pr113688.c
+new file mode 100644
+index 000000000000..8dee8c86f1bf
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/pr113688.c
+@@ -0,0 +1,8 @@
++/* { dg-do compile } */
++/* { dg-options "-g" } */
++
++struct S{int x,y[1];}*a;
++int main(void){
++	struct S{int x,y[];};
++}
++
+diff --git a/gcc/testsuite/gcc.dg/pr114014.c b/gcc/testsuite/gcc.dg/pr114014.c
+new file mode 100644
+index 000000000000..1531ffab1b75
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/pr114014.c
+@@ -0,0 +1,14 @@
++/* PR c/114014
++ * { dg-do compile }
++ * { dg-options "-std=gnu23 -g" } */
++
++struct r {
++  int a;
++  char b[];
++};
++struct r {
++  int a;
++  char b[0];
++};
++
++
+diff --git a/gcc/testsuite/gcc.dg/pr114713.c b/gcc/testsuite/gcc.dg/pr114713.c
+new file mode 100644
+index 000000000000..1f0ad39c433c
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/pr114713.c
+@@ -0,0 +1,35 @@
++/* { dg-do run } */
++/* { dg-require-effective-target lto } */
++/* { dg-options "-flto -O2" } */
++
++struct foo { int x; char a[]; };
++
++void test_bar(void* b);
++
++__attribute__((noinline))
++int test_foo(struct foo* a, void* b)
++{
++        a->x = 1;
++        test_bar(b);
++        return a->x;
++}
++
++int main()
++{
++        struct foo y;
++
++        if (2 != test_foo(&y, &y))
++                __builtin_abort();
++
++        return 0;
++}
++
++// TU2
++struct foo { int x; char a[0]; };
++
++void test_bar(void* b)
++{
++        struct foo *p = b;
++        p->x = 2;
++}
++
+diff --git a/gcc/testsuite/gcc.dg/pr117724.c b/gcc/testsuite/gcc.dg/pr117724.c
+new file mode 100644
+index 000000000000..d631daeb644d
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/pr117724.c
+@@ -0,0 +1,16 @@
++/* { dg-do compile } */
++/* { dg-options "-g" } */
++
++struct {
++  unsigned long len;
++  unsigned long size;
++  char data[];
++};			/* { dg-warning "unnamed struct" } */
++struct {
++  struct {
++    unsigned long len;
++    unsigned long size;
++    char data[6];
++  };
++};			/* { dg-warning "unnamed struct" } */
++
+diff --git a/gcc/tree.cc b/gcc/tree.cc
+index 1391af6bd4c3..9803d16805c4 100644
+--- a/gcc/tree.cc
++++ b/gcc/tree.cc
+@@ -13838,7 +13838,6 @@ type_with_interoperable_signedness (const_tree type)
+    that have TYPE_CANONICAL defined and assume them equivalent.  This is useful
+    only for LTO because only in these cases TYPE_CANONICAL equivalence
+    correspond to one defined by gimple_canonical_types_compatible_p.  */
+-
+ bool
+ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
+ 				     bool trust_type_canonical)
+@@ -13969,7 +13968,7 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
+     {
+     case ARRAY_TYPE:
+       /* Array types are the same if the element types are the same and
+-	 the number of elements are the same.  */
++	 minimum and maximum index are the same.  */
+       if (!gimple_canonical_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2),
+ 						trust_type_canonical)
+ 	  || TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2)
+@@ -14063,23 +14062,46 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
+ 	     f1 || f2;
+ 	     f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2))
+ 	  {
+-	    /* Skip non-fields and zero-sized fields.  */
++	    /* Skip non-fields and zero-sized fields, except zero-sized
++	       arrays at the end.  */
+ 	    while (f1 && (TREE_CODE (f1) != FIELD_DECL
+ 			  || (DECL_SIZE (f1)
+-			      && integer_zerop (DECL_SIZE (f1)))))
++			      && integer_zerop (DECL_SIZE (f1))
++			      && (TREE_CHAIN (f1)
++				  || TREE_CODE (TREE_TYPE (f1))
++				     != ARRAY_TYPE))))
+ 	      f1 = TREE_CHAIN (f1);
+ 	    while (f2 && (TREE_CODE (f2) != FIELD_DECL
+ 			  || (DECL_SIZE (f2)
+-			      && integer_zerop (DECL_SIZE (f2)))))
++			      && integer_zerop (DECL_SIZE (f2))
++			      && (TREE_CHAIN (f2)
++				  || TREE_CODE (TREE_TYPE (f2))
++				     != ARRAY_TYPE))))
+ 	      f2 = TREE_CHAIN (f2);
+ 	    if (!f1 || !f2)
+ 	      break;
+-	    /* The fields must have the same name, offset and type.  */
++
++	    tree t1 = TREE_TYPE (f1);
++	    tree t2 = TREE_TYPE (f2);
++
++	    /* If the last element are arrays, we only compare the element
++	       types.  */
++	    if (TREE_CHAIN (f1) == NULL_TREE && TREE_CODE (t1) == ARRAY_TYPE
++		&& TREE_CHAIN (f2) == NULL_TREE && TREE_CODE (t2) == ARRAY_TYPE)
++	      {
++		/* If both arrays have zero size, this is a match.  */
++		if (DECL_SIZE (f1) && integer_zerop (DECL_SIZE (f1))
++		    && DECL_SIZE (f2) && integer_zerop (DECL_SIZE (f2)))
++		  return true;
++
++		t1 = TREE_TYPE (t1);
++		t2 = TREE_TYPE (t2);
++	      }
++
+ 	    if (DECL_NONADDRESSABLE_P (f1) != DECL_NONADDRESSABLE_P (f2)
+ 		|| !gimple_compare_field_offset (f1, f2)
+ 		|| !gimple_canonical_types_compatible_p
+-		      (TREE_TYPE (f1), TREE_TYPE (f2),
+-		       trust_type_canonical))
++		      (t1, t2, trust_type_canonical))
+ 	      return false;
+ 	  }
+ 
+-- 
+2.47.1
+

diff --git a/15.0.0/gentoo/75_all_PR117724-testsuite-fix-LTO-flags-in-pr112716.c.patch b/15.0.0/gentoo/75_all_PR117724-testsuite-fix-LTO-flags-in-pr112716.c.patch
deleted file mode 100644
index f36840e..0000000
--- a/15.0.0/gentoo/75_all_PR117724-testsuite-fix-LTO-flags-in-pr112716.c.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 2f961c392ab359286ef1350d37e50e7841773d7b Mon Sep 17 00:00:00 2001
-Message-ID: <2f961c392ab359286ef1350d37e50e7841773d7b.1733713329.git.sam@gentoo.org>
-In-Reply-To: <e1d3dfa0936ca5b50c87f6ddf5347fa401a703f6.1733713329.git.sam@gentoo.org>
-References: <e1d3dfa0936ca5b50c87f6ddf5347fa401a703f6.1733713329.git.sam@gentoo.org>
-From: Sam James <sam@gentoo.org>
-Date: Mon, 9 Dec 2024 03:01:47 +0000
-Subject: [PATCH 2/2] testsuite: fix LTO flags in pr112716.c
-
----
- gcc/testsuite/gcc.dg/pr112716.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/gcc/testsuite/gcc.dg/pr112716.c b/gcc/testsuite/gcc.dg/pr112716.c
-index 109dd252f0d6..873eedaafd18 100644
---- a/gcc/testsuite/gcc.dg/pr112716.c
-+++ b/gcc/testsuite/gcc.dg/pr112716.c
-@@ -1,5 +1,6 @@
- /* { dg-do compile } */
--/* { dg-options "-lfto -O2" } */
-+/* { dg-options "-flto -O2" } */
-+/* { dg-require-effective-target lto } */
- 
- #define T1 int[n]
- #define T2 int[n]
--- 
-2.47.1
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 639981b..50ec527 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -3,7 +3,7 @@
 	U 24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
 	U 26_all_enable-cet.patch
 	+ 74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
-	+ 75_all_PR117724-testsuite-fix-LTO-flags-in-pr112716.c.patch
+	+ 75_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array-2.patch
 	+ 76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch
 
 30	8 December 2024


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-10 19:19 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-10 19:19 UTC (permalink / raw
  To: gentoo-commits

commit:     da4a3098bbcf081bb00723bf7aacab98ff8e5a72
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 10 19:17:46 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 10 19:17:46 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=da4a3098

15.0.0: cut patchset 10

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 50ec527..abc05c8 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-31	???
+31	10 December 2024
 
 	U 24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
 	U 26_all_enable-cet.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-11  0:58 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-11  0:58 UTC (permalink / raw
  To: gentoo-commits

commit:     51abf0facc39318f1b2e9f952ab7842ba422d401
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 11 00:58:13 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 11 00:58:13 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=51abf0fa

15.0.0: add 77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch

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

 ..._all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch b/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
new file mode 100644
index 0000000..ba2fa9a
--- /dev/null
+++ b/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
@@ -0,0 +1,13 @@
+diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
+index 623e2ee6e964..a861331c7c7d 100644
+--- a/gcc/cp/cp-gimplify.cc
++++ b/gcc/cp/cp-gimplify.cc
+@@ -1477,7 +1477,7 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_)
+ 	  *walk_subtrees = 0;
+ 	  if (!flag_no_inline)
+ 	    {
+-	      tree folded = maybe_constant_init (init, TARGET_EXPR_SLOT (stmt));
++	      tree folded = maybe_constant_init (init);
+ 	      if (folded != init && TREE_CONSTANT (folded))
+ 		init = folded;
+ 	    }


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-11  4:41 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-11  4:41 UTC (permalink / raw
  To: gentoo-commits

commit:     bab06f8fff99acedad7703b604dd781a0f5554a0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 11 04:41:01 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 11 04:41:01 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bab06f8f

15.0.0: add comment link to 77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch

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

 .../gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch b/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
index ba2fa9a..1252fc2 100644
--- a/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
+++ b/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
@@ -1,5 +1,4 @@
-diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
-index 623e2ee6e964..a861331c7c7d 100644
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117980#c7
 --- a/gcc/cp/cp-gimplify.cc
 +++ b/gcc/cp/cp-gimplify.cc
 @@ -1477,7 +1477,7 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_)


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-12 12:28 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-12 12:28 UTC (permalink / raw
  To: gentoo-commits

commit:     5dc272f0f180fae9fc937881a213cbe907e5a8f8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 12 12:27:59 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 12 12:28:21 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5dc272f0

15.0.0: drop C23 FAM fixes

Now upstream.

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

 ...mpatibility-for-types-with-flexible-array.patch |  80 -------
 ...atibility-for-types-with-flexible-array-2.patch | 250 ---------------------
 15.0.0/gentoo/README.history                       |   5 +
 3 files changed, 5 insertions(+), 330 deletions(-)

diff --git a/15.0.0/gentoo/74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch b/15.0.0/gentoo/74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
deleted file mode 100644
index 1b682ad..0000000
--- a/15.0.0/gentoo/74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From 511aac7c85e6cc2ce474e1169dadd17c570743ec Mon Sep 17 00:00:00 2001
-Message-ID: <511aac7c85e6cc2ce474e1169dadd17c570743ec.1733842378.git.sam@gentoo.org>
-From: Martin Uecker <uecker@tugraz.at>
-Date: Tue, 10 Dec 2024 13:29:27 +0100
-Subject: [PATCH 1/2] Fix type compatibility for types with flexible array
- member [PR113688,PR114713,PR117724]
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-As requested, I split up into one part for the TYPE_MODE and 
-another one for the array size to help with git bisecting.  This
-is the first part.
-
-Bootstrapped and regression tested on x86_64.
-
-Allow the TYPE_MODE of a type with an array as last member to differ from
-another compatible type.
-
-gcc/ChangeLog:
-        * tree.cc (gimple_canonical_types_compatible_p): Add exception.
-        (verify_type): Add exception.
-
-gcc/lto/ChangeLog:
-        * lto-common.cc (hash_canonical_type): Add exception.
----
- gcc/lto/lto-common.cc |  3 ++-
- gcc/tree.cc           | 12 +++++++++---
- 2 files changed, 11 insertions(+), 4 deletions(-)
-
-diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
-index 86a309f92b40..940502099128 100644
---- a/gcc/lto/lto-common.cc
-+++ b/gcc/lto/lto-common.cc
-@@ -254,7 +254,8 @@ hash_canonical_type (tree type)
-      checked.  */
-   code = tree_code_for_canonical_type_merging (TREE_CODE (type));
-   hstate.add_int (code);
--  hstate.add_int (TYPE_MODE (type));
-+  if (!RECORD_OR_UNION_TYPE_P (type))
-+    hstate.add_int (TYPE_MODE (type));
- 
-   /* Incorporate common features of numerical types.  */
-   if (INTEGRAL_TYPE_P (type)
-diff --git a/gcc/tree.cc b/gcc/tree.cc
-index 83a03374a325..1391af6bd4c3 100644
---- a/gcc/tree.cc
-+++ b/gcc/tree.cc
-@@ -13914,8 +13914,11 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
-       || TREE_CODE (t1) == NULLPTR_TYPE)
-     return true;
- 
--  /* Can't be the same type if they have different mode.  */
--  if (TYPE_MODE (t1) != TYPE_MODE (t2))
-+  /* Can't be compatible types if they have different mode.  Because of
-+     flexible array members, we allow mismatching modes for structures or
-+     unions.  */
-+  if (!RECORD_OR_UNION_TYPE_P (t1)
-+      && TYPE_MODE (t1) != TYPE_MODE (t2))
-     return false;
- 
-   /* Non-aggregate types can be handled cheaply.  */
-@@ -14218,8 +14221,11 @@ verify_type (const_tree t)
-       debug_tree (ct);
-       error_found = true;
-     }
--
-   if (COMPLETE_TYPE_P (t) && TYPE_CANONICAL (t)
-+      /* We allow a mismatch for structure or union because of
-+	 flexible array members.  */
-+      && !RECORD_OR_UNION_TYPE_P (t)
-+      && !RECORD_OR_UNION_TYPE_P (TYPE_CANONICAL (t))
-       && TYPE_MODE (t) != TYPE_MODE (TYPE_CANONICAL (t)))
-     {
-       error ("%<TYPE_MODE%> of %<TYPE_CANONICAL%> is not compatible");
-
-base-commit: 34dfb30ca8dba6bc184e563b0ddc26a5239294e3
--- 
-2.47.1
-

diff --git a/15.0.0/gentoo/75_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array-2.patch b/15.0.0/gentoo/75_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array-2.patch
deleted file mode 100644
index 1f35b83..0000000
--- a/15.0.0/gentoo/75_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array-2.patch
+++ /dev/null
@@ -1,250 +0,0 @@
-From 4bc7c98e86392a36f75029eabbe096d1bf9e85b5 Mon Sep 17 00:00:00 2001
-Message-ID: <4bc7c98e86392a36f75029eabbe096d1bf9e85b5.1733842378.git.sam@gentoo.org>
-In-Reply-To: <511aac7c85e6cc2ce474e1169dadd17c570743ec.1733842378.git.sam@gentoo.org>
-References: <511aac7c85e6cc2ce474e1169dadd17c570743ec.1733842378.git.sam@gentoo.org>
-From: Martin Uecker <uecker@tugraz.at>
-Date: Tue, 10 Dec 2024 13:31:50 +0100
-Subject: [PATCH 2/2] Fix type compatibility for types with flexible array
- member [PR113688,PR114713,PR117724]
-
-The second part now only contains the changes for array size.
-
-I added back a special case for this instead of having the
-'ignore_size' flag (which I would nevertheless assume might be
-needed in the future when matching pointer types).
-
-In this version, I added an exception to the special case to ignore
-the case were both are zero-sized arrays, because this seems to be
-the only case were the new code would otherwise be stricter than the
-old code.
-
-I also replaced/fixed one test where I accidentally included a similar
-test for another closely related bug involving VLA types.
-
-Bootstrapped and regression tested on x86_64.
-
-For checking or computing TYPE_CANONICAL, ignore the array size when it is
-the last element of a structure or union.  To not get errors because of
-an inconsistent number of members, zero-sized arrays which are the last
-element are not ignored anymore when checking the fields of a struct.
-
-	PR c/113688
-	PR c/114014
-	PR c/114713
-	PR c/117724
-
-gcc/ChangeLog:
-	* tree.cc (gimple_canonical_types_compatible_p): Add exception.
-
-gcc/lto/ChangeLog:
-	* lto-common.cc (hash_canonical_type): Add exception.
-
-gcc/testsuite/ChangeLog:
-	* gcc.dg/pr113688.c: New test.
-	* gcc.dg/pr114014.c: New test.
-	* gcc.dg/pr114713.c: New test.
-	* gcc.dg/pr117724.c: New test.
----
- gcc/lto/lto-common.cc           |  6 +++++-
- gcc/testsuite/gcc.dg/pr113688.c |  8 +++++++
- gcc/testsuite/gcc.dg/pr114014.c | 14 ++++++++++++
- gcc/testsuite/gcc.dg/pr114713.c | 35 ++++++++++++++++++++++++++++++
- gcc/testsuite/gcc.dg/pr117724.c | 16 ++++++++++++++
- gcc/tree.cc                     | 38 ++++++++++++++++++++++++++-------
- 6 files changed, 108 insertions(+), 9 deletions(-)
- create mode 100644 gcc/testsuite/gcc.dg/pr113688.c
- create mode 100644 gcc/testsuite/gcc.dg/pr114014.c
- create mode 100644 gcc/testsuite/gcc.dg/pr114713.c
- create mode 100644 gcc/testsuite/gcc.dg/pr117724.c
-
-diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
-index 940502099128..f65a9d1c7b6f 100644
---- a/gcc/lto/lto-common.cc
-+++ b/gcc/lto/lto-common.cc
-@@ -333,7 +333,11 @@ hash_canonical_type (tree type)
- 	    && (! DECL_SIZE (f)
- 		|| ! integer_zerop (DECL_SIZE (f))))
- 	  {
--	    iterative_hash_canonical_type (TREE_TYPE (f), hstate);
-+	    tree t = TREE_TYPE (f);
-+	    if (!TREE_CHAIN (f)
-+		&& TREE_CODE (t) == ARRAY_TYPE)
-+	      t = TREE_TYPE  (t);
-+	    iterative_hash_canonical_type (t, hstate);
- 	    nf++;
- 	  }
- 
-diff --git a/gcc/testsuite/gcc.dg/pr113688.c b/gcc/testsuite/gcc.dg/pr113688.c
-new file mode 100644
-index 000000000000..8dee8c86f1bf
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/pr113688.c
-@@ -0,0 +1,8 @@
-+/* { dg-do compile } */
-+/* { dg-options "-g" } */
-+
-+struct S{int x,y[1];}*a;
-+int main(void){
-+	struct S{int x,y[];};
-+}
-+
-diff --git a/gcc/testsuite/gcc.dg/pr114014.c b/gcc/testsuite/gcc.dg/pr114014.c
-new file mode 100644
-index 000000000000..1531ffab1b75
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/pr114014.c
-@@ -0,0 +1,14 @@
-+/* PR c/114014
-+ * { dg-do compile }
-+ * { dg-options "-std=gnu23 -g" } */
-+
-+struct r {
-+  int a;
-+  char b[];
-+};
-+struct r {
-+  int a;
-+  char b[0];
-+};
-+
-+
-diff --git a/gcc/testsuite/gcc.dg/pr114713.c b/gcc/testsuite/gcc.dg/pr114713.c
-new file mode 100644
-index 000000000000..1f0ad39c433c
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/pr114713.c
-@@ -0,0 +1,35 @@
-+/* { dg-do run } */
-+/* { dg-require-effective-target lto } */
-+/* { dg-options "-flto -O2" } */
-+
-+struct foo { int x; char a[]; };
-+
-+void test_bar(void* b);
-+
-+__attribute__((noinline))
-+int test_foo(struct foo* a, void* b)
-+{
-+        a->x = 1;
-+        test_bar(b);
-+        return a->x;
-+}
-+
-+int main()
-+{
-+        struct foo y;
-+
-+        if (2 != test_foo(&y, &y))
-+                __builtin_abort();
-+
-+        return 0;
-+}
-+
-+// TU2
-+struct foo { int x; char a[0]; };
-+
-+void test_bar(void* b)
-+{
-+        struct foo *p = b;
-+        p->x = 2;
-+}
-+
-diff --git a/gcc/testsuite/gcc.dg/pr117724.c b/gcc/testsuite/gcc.dg/pr117724.c
-new file mode 100644
-index 000000000000..d631daeb644d
---- /dev/null
-+++ b/gcc/testsuite/gcc.dg/pr117724.c
-@@ -0,0 +1,16 @@
-+/* { dg-do compile } */
-+/* { dg-options "-g" } */
-+
-+struct {
-+  unsigned long len;
-+  unsigned long size;
-+  char data[];
-+};			/* { dg-warning "unnamed struct" } */
-+struct {
-+  struct {
-+    unsigned long len;
-+    unsigned long size;
-+    char data[6];
-+  };
-+};			/* { dg-warning "unnamed struct" } */
-+
-diff --git a/gcc/tree.cc b/gcc/tree.cc
-index 1391af6bd4c3..9803d16805c4 100644
---- a/gcc/tree.cc
-+++ b/gcc/tree.cc
-@@ -13838,7 +13838,6 @@ type_with_interoperable_signedness (const_tree type)
-    that have TYPE_CANONICAL defined and assume them equivalent.  This is useful
-    only for LTO because only in these cases TYPE_CANONICAL equivalence
-    correspond to one defined by gimple_canonical_types_compatible_p.  */
--
- bool
- gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
- 				     bool trust_type_canonical)
-@@ -13969,7 +13968,7 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
-     {
-     case ARRAY_TYPE:
-       /* Array types are the same if the element types are the same and
--	 the number of elements are the same.  */
-+	 minimum and maximum index are the same.  */
-       if (!gimple_canonical_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2),
- 						trust_type_canonical)
- 	  || TYPE_STRING_FLAG (t1) != TYPE_STRING_FLAG (t2)
-@@ -14063,23 +14062,46 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
- 	     f1 || f2;
- 	     f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2))
- 	  {
--	    /* Skip non-fields and zero-sized fields.  */
-+	    /* Skip non-fields and zero-sized fields, except zero-sized
-+	       arrays at the end.  */
- 	    while (f1 && (TREE_CODE (f1) != FIELD_DECL
- 			  || (DECL_SIZE (f1)
--			      && integer_zerop (DECL_SIZE (f1)))))
-+			      && integer_zerop (DECL_SIZE (f1))
-+			      && (TREE_CHAIN (f1)
-+				  || TREE_CODE (TREE_TYPE (f1))
-+				     != ARRAY_TYPE))))
- 	      f1 = TREE_CHAIN (f1);
- 	    while (f2 && (TREE_CODE (f2) != FIELD_DECL
- 			  || (DECL_SIZE (f2)
--			      && integer_zerop (DECL_SIZE (f2)))))
-+			      && integer_zerop (DECL_SIZE (f2))
-+			      && (TREE_CHAIN (f2)
-+				  || TREE_CODE (TREE_TYPE (f2))
-+				     != ARRAY_TYPE))))
- 	      f2 = TREE_CHAIN (f2);
- 	    if (!f1 || !f2)
- 	      break;
--	    /* The fields must have the same name, offset and type.  */
-+
-+	    tree t1 = TREE_TYPE (f1);
-+	    tree t2 = TREE_TYPE (f2);
-+
-+	    /* If the last element are arrays, we only compare the element
-+	       types.  */
-+	    if (TREE_CHAIN (f1) == NULL_TREE && TREE_CODE (t1) == ARRAY_TYPE
-+		&& TREE_CHAIN (f2) == NULL_TREE && TREE_CODE (t2) == ARRAY_TYPE)
-+	      {
-+		/* If both arrays have zero size, this is a match.  */
-+		if (DECL_SIZE (f1) && integer_zerop (DECL_SIZE (f1))
-+		    && DECL_SIZE (f2) && integer_zerop (DECL_SIZE (f2)))
-+		  return true;
-+
-+		t1 = TREE_TYPE (t1);
-+		t2 = TREE_TYPE (t2);
-+	      }
-+
- 	    if (DECL_NONADDRESSABLE_P (f1) != DECL_NONADDRESSABLE_P (f2)
- 		|| !gimple_compare_field_offset (f1, f2)
- 		|| !gimple_canonical_types_compatible_p
--		      (TREE_TYPE (f1), TREE_TYPE (f2),
--		       trust_type_canonical))
-+		      (t1, t2, trust_type_canonical))
- 	      return false;
- 	  }
- 
--- 
-2.47.1
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index abc05c8..8b73c10 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,8 @@
+32	????
+
+	- 74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
+	- 75_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array-2.patch
+
 31	10 December 2024
 
 	U 24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-13  5:08 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-13  5:08 UTC (permalink / raw
  To: gentoo-commits

commit:     9af17f2c6db4433f71d81aed95fca9a95780bb25
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 13 05:08:30 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 13 05:08:30 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9af17f2c

15.0.0: update C++ ICE patch

The actual fix is the same but it adds testcases and a commit message, so
let's sync up.

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

 ...7980-ICE-cxx_eval_outermost_constant_expr.patch | 120 ++++++++++++++++++++-
 1 file changed, 119 insertions(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch b/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
index 1252fc2..f077536 100644
--- a/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
+++ b/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
@@ -1,4 +1,64 @@
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117980#c7
+https://inbox.sourceware.org/gcc-patches/20241212184222.471783-1-polacek@redhat.com/
+
+From f9ec39fcb8905fad2aba87bf328f0d5934b2385d Mon Sep 17 00:00:00 2001
+Message-ID: <f9ec39fcb8905fad2aba87bf328f0d5934b2385d.1734066473.git.sam@gentoo.org>
+From: Marek Polacek <polacek@redhat.com>
+Date: Thu, 12 Dec 2024 13:42:22 -0500
+Subject: [PATCH] c++: ICE in TARGET_EXPR evaluation in cp_fold_r [PR117980]
+
+This ICE started with the recent prvalue optimization (r15-6052).  In
+cp_fold_r we have:
+
+      if (tree &init = TARGET_EXPR_INITIAL (stmt))
+        {
+          cp_walk_tree (&init, cp_fold_r, data, NULL);
+          // ...
+	  tree folded = maybe_constant_init (init, TARGET_EXPR_SLOT (stmt));
+
+What can happen here is that originally the TARGET_EXPR is:
+
+    TARGET_EXPR <D.2747, <<< Unknown tree: aggr_init_expr
+      5
+      __ct_comp
+      D.2747
+      (struct subrange *) <<< Unknown tree: void_cst >>>
+      &TARGET_EXPR <D.2707, {.it=TARGET_EXPR <D.2695, ...>}> >>>>
+
+but after the first cp_walk_tree we fold the D.2707 TARGET_EXPR into:
+
+    TARGET_EXPR <D.2707, <<< Unknown tree: expr_stmt
+      D.2707.it = TARGET_EXPR <D.2695, ...> >>>>
+
+and then we pass the EXPR_STMT to maybe_constant_init, with D.2707 as
+the object.  But their types don't match anymore, so we crash.  We'd
+have to pass D.2707.it as the object for it to work.
+
+But I don't think we need to pass any object to maybe_constant_init;
+it'll grab the appropriate one itself.
+
+constexpr-prvalue3.C is reduced from a large std::ranges libstdc++ test.
+
+	PR c++/117980
+
+gcc/cp/ChangeLog:
+
+	* cp-gimplify.cc (cp_fold_r) <case TARGET_EXPR>: Don't pass an object
+	to maybe_constant_init.
+
+gcc/testsuite/ChangeLog:
+
+* g++.dg/cpp0x/constexpr-prvalue2.C: New test.
+	* g++.dg/cpp0x/constexpr-prvalue3.C: New test.
+---
+ gcc/cp/cp-gimplify.cc                         |  2 +-
+ .../g++.dg/cpp0x/constexpr-prvalue2.C         | 15 +++++++++++
+ .../g++.dg/cpp0x/constexpr-prvalue3.C         | 26 +++++++++++++++++++
+ 3 files changed, 42 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue2.C
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue3.C
+
+diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
+index 623e2ee6e964..a861331c7c7d 100644
 --- a/gcc/cp/cp-gimplify.cc
 +++ b/gcc/cp/cp-gimplify.cc
 @@ -1477,7 +1477,7 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_)
@@ -10,3 +70,61 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117980#c7
  	      if (folded != init && TREE_CONSTANT (folded))
  		init = folded;
  	    }
+diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue2.C
+new file mode 100644
+index 000000000000..46053231cf83
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue2.C
+@@ -0,0 +1,15 @@
++// PR c++/117980
++// { dg-do compile { target c++11 } }
++// { dg-options "-O" }
++
++struct S {
++  constexpr S(S &); // { dg-warning "used but never defined" }
++  ~S();
++};
++struct B {
++  S s;
++};
++struct A {
++  B b;
++};
++void fn(B b) { A{b}; }
+diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue3.C
+new file mode 100644
+index 000000000000..a2eb12c02d74
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue3.C
+@@ -0,0 +1,26 @@
++// PR c++/117980
++// { dg-do compile { target c++11 } }
++// { dg-options "-O" }
++
++struct _Safe_iterator  {
++ _Safe_iterator();
++  ~_Safe_iterator();
++};
++template <typename _Tp>
++struct vector {
++  vector(int) {}
++  constexpr _Safe_iterator end() {
++    return _Safe_iterator();
++  }
++};
++template <typename It> struct sentinel {
++  It it;
++};
++template <typename _Sent>
++struct subrange {
++  subrange(sentinel<_Safe_iterator>) {}
++};
++void test01() {
++  vector<int> v{0};
++  subrange<sentinel<_Safe_iterator>>{sentinel<_Safe_iterator>{v.end()}};
++}
+
+base-commit: d136fa00f0d5faff8397edcd7e4ebb3445ab21b0
+-- 
+2.47.1
+


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-13 11:52 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-13 11:52 UTC (permalink / raw
  To: gentoo-commits

commit:     43890f63608afe071e8a5d5c5d3237956a527ea8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 13 11:51:58 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 13 11:51:58 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=43890f63

15.0.0: update 72_all_PR111600-genrecog-Split-into-separate-partitions.patch

Includes configure regen.

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

 ...0-genrecog-Split-into-separate-partitions.patch | 47 ++++++++++++++++------
 1 file changed, 35 insertions(+), 12 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR111600-genrecog-Split-into-separate-partitions.patch b/15.0.0/gentoo/72_all_PR111600-genrecog-Split-into-separate-partitions.patch
index 07486e4..ae2b837 100644
--- a/15.0.0/gentoo/72_all_PR111600-genrecog-Split-into-separate-partitions.patch
+++ b/15.0.0/gentoo/72_all_PR111600-genrecog-Split-into-separate-partitions.patch
@@ -1,5 +1,5 @@
-From 1135970eb38c8f90db20c12cb4222e3a5214557e Mon Sep 17 00:00:00 2001
-Message-ID: <1135970eb38c8f90db20c12cb4222e3a5214557e.1732630692.git.sam@gentoo.org>
+From eea603288d8d6cfd795c42c8f731d06f8af6828a Mon Sep 17 00:00:00 2001
+Message-ID: <eea603288d8d6cfd795c42c8f731d06f8af6828a.1734090687.git.sam@gentoo.org>
 From: Robin Dapp <rdapp.gcc@gmail.com>
 Date: Tue, 26 Nov 2024 14:44:17 +0100
 Subject: [PATCH] genrecog: Split into separate partitions [PR111600].
@@ -55,6 +55,7 @@ gcc/ChangeLog:
 	* read-md.h (class md_reader): Ditto.
 ---
  gcc/Makefile.in      |  29 ++-
+ gcc/configure        |   4 +-
  gcc/configure.ac     |   4 +-
  gcc/genconditions.cc |   4 +-
  gcc/genpreds.cc      |   4 +-
@@ -62,10 +63,10 @@ gcc/ChangeLog:
  gcc/gentarget-def.cc |   2 +-
  gcc/read-md.cc       |   4 +-
  gcc/read-md.h        |   2 +-
- 8 files changed, 358 insertions(+), 243 deletions(-)
+ 9 files changed, 360 insertions(+), 245 deletions(-)
 
 diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index ead8d2eb094c..d301bef47003 100644
+index 27fbbd4bf19e..493ec6a5cb6e 100644
 --- a/gcc/Makefile.in
 +++ b/gcc/Makefile.in
 @@ -239,6 +239,12 @@ INSNEMIT_SEQ_SRC = $(patsubst %, insn-emit-%.cc, $(INSNEMIT_SPLITS_SEQ))
@@ -90,7 +91,7 @@ index ead8d2eb094c..d301bef47003 100644
  	insn-enums.o \
  	ggc-page.o \
  	adjust-alignment.o \
-@@ -1903,8 +1909,8 @@ TREECHECKING = @TREECHECKING@
+@@ -1909,8 +1915,8 @@ TREECHECKING = @TREECHECKING@
  FULL_DRIVER_NAME=$(target_noncanonical)-gcc-$(version)$(exeext)
  
  MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
@@ -101,7 +102,7 @@ index ead8d2eb094c..d301bef47003 100644
   insn-attr.h insn-attr-common.h insn-attrtab.cc insn-dfatab.cc \
   insn-latencytab.cc insn-opinit.cc insn-opinit.h insn-preds.cc insn-constants.h \
   tm-preds.h tm-constrs.h checksum-options $(GIMPLE_MATCH_PD_SEQ_SRC) \
-@@ -2671,7 +2677,8 @@ $(common_out_object_file): $(common_out_file)
+@@ -2677,7 +2683,8 @@ $(common_out_object_file): $(common_out_file)
  # and compile them.
  
  .PRECIOUS: insn-config.h insn-flags.h insn-codes.h insn-constants.h \
@@ -111,7 +112,7 @@ index ead8d2eb094c..d301bef47003 100644
    insn-peep.cc insn-attr.h insn-attr-common.h insn-attrtab.cc \
    insn-dfatab.cc insn-latencytab.cc insn-preds.cc \
    $(GIMPLE_MATCH_PD_SEQ_SRC) $(GENERIC_MATCH_PD_SEQ_SRC) \
-@@ -2700,7 +2707,7 @@ simple_rtl_generated_h	= insn-attr.h insn-attr-common.h insn-codes.h \
+@@ -2706,7 +2713,7 @@ simple_rtl_generated_h	= insn-attr.h insn-attr-common.h insn-codes.h \
  
  simple_rtl_generated_c	= insn-automata.cc \
  			  insn-extract.cc insn-output.cc \
@@ -120,7 +121,7 @@ index ead8d2eb094c..d301bef47003 100644
  
  simple_generated_h	= $(simple_rtl_generated_h) insn-constants.h
  
-@@ -2738,6 +2745,18 @@ s-tmp-emit: build/genemit$(build_exeext) $(MD_DEPS) insn-conditions.md
+@@ -2744,6 +2751,18 @@ s-tmp-emit: build/genemit$(build_exeext) $(MD_DEPS) insn-conditions.md
  	  insn-emit-$(id).cc;)
  	$(STAMP) s-tmp-emit
  
@@ -139,11 +140,33 @@ index ead8d2eb094c..d301bef47003 100644
  # gencheck doesn't read the machine description, and the file produced
  # doesn't use the insn-* convention.
  
+diff --git a/gcc/configure b/gcc/configure
+index 0a55fa75573b..a8b531d8fae0 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -1873,7 +1873,7 @@ Optional Packages:
+                           generic when splitting match.pd. [default=10]
+   --with-insnemit-partitions=num
+                           Set the number of partitions of insn-emit.cc for
+-                          genemit to create. [default=10]
++                          genemit and genrecog to create. [default=10]
+   --with-dwarf2           force the default debug format to be DWARF 2 (or
+                           later)
+   --with-specs=SPECS      add SPECS to driver command-line processing
+@@ -7936,7 +7936,7 @@ fi
+ 
+ 
+ 
+-# Specify the number of splits of insn-emit.cc to generate.
++# Specify the number of splits of insn-emit.cc and insn-recog.cc to generate.
+ 
+ # Check whether --with-insnemit-partitions was given.
+ if test "${with_insnemit_partitions+set}" = set; then :
 diff --git a/gcc/configure.ac b/gcc/configure.ac
-index c546432b2775..a0d9038ea595 100644
+index 1a6f01e25675..77fab885a428 100644
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
-@@ -913,10 +913,10 @@ fi
+@@ -929,10 +929,10 @@ fi
  
  AC_SUBST(DEFAULT_MATCHPD_PARTITIONS)
  
@@ -195,7 +218,7 @@ index 55d149e8a404..b8f3bf279d97 100644
  		  "        SET_HARD_REG_BIT (%s[%d], regno);\n",
  		  "this_target_constraints->register_filters", i);
 diff --git a/gcc/genrecog.cc b/gcc/genrecog.cc
-index ba09ec3b6005..7f7ca728bbe0 100644
+index 719b1d44387e..1852ceba2513 100644
 --- a/gcc/genrecog.cc
 +++ b/gcc/genrecog.cc
 @@ -4255,9 +4255,9 @@ match_pattern (state *s, md_rtx_info *info, rtx pattern,
@@ -1363,7 +1386,7 @@ index e613c42b7241..b42add391ed8 100644
    /* Defined in read-rtl.cc.  */
    const char *apply_iterator_to_string (const char *string);
 
-base-commit: a22dfe208d94105a6e587a3b25e8fe8d62444d8a
+base-commit: 6a5a1b8175e07ff578204476cd11115d8a071cbc
 -- 
 2.47.1
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-13 13:23 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-13 13:23 UTC (permalink / raw
  To: gentoo-commits

commit:     d868db5ada6f12bebdcbf4a9ec1d0814c1cbafd8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 13 13:23:15 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 13 13:23:15 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=d868db5a

15.0.0: drop 72_all_PR111600-genrecog-Split-into-separate-partitions.patch

Now upstream.

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

 ...0-genrecog-Split-into-separate-partitions.patch | 1392 --------------------
 15.0.0/gentoo/README.history                       |    1 +
 2 files changed, 1 insertion(+), 1392 deletions(-)

diff --git a/15.0.0/gentoo/72_all_PR111600-genrecog-Split-into-separate-partitions.patch b/15.0.0/gentoo/72_all_PR111600-genrecog-Split-into-separate-partitions.patch
deleted file mode 100644
index ae2b837..0000000
--- a/15.0.0/gentoo/72_all_PR111600-genrecog-Split-into-separate-partitions.patch
+++ /dev/null
@@ -1,1392 +0,0 @@
-From eea603288d8d6cfd795c42c8f731d06f8af6828a Mon Sep 17 00:00:00 2001
-Message-ID: <eea603288d8d6cfd795c42c8f731d06f8af6828a.1734090687.git.sam@gentoo.org>
-From: Robin Dapp <rdapp.gcc@gmail.com>
-Date: Tue, 26 Nov 2024 14:44:17 +0100
-Subject: [PATCH] genrecog: Split into separate partitions [PR111600].
-
-Hi,
-
-this patch makes genrecog split its output into separate files (10 by
-default) in the same vein genemit does.  The changes are mostly
-mechanical again, changing printfs and puts to fprintf.
-As insn-recog.cc relies on being able to call other recog functions a
-header insn-recog.h is introduced that pre declares all of those.
-
-For simplicity the number of files is determined by (re-using)
---with-insnemit-partitions.  Naming suggestions welcome :)
-
-Bootstrapped and regtested on x86 and power10, regtested on riscv.
-aarch64 bootstrap is currently blocked because of the
-"maybe uninitialized" issue discussed on IRC.
-
-Regards
- Robin
-
-gcc/ChangeLog:
-
-* Makefile.in:  Add insn-recog split.
-	* configure.ac: Document that the number of insnemit partitions is
-	used for insn-recog as well.
-	* genconditions.cc (write_one_condition): Use fprintf.
-	* genpreds.cc (write_predicate_expr): Ditto.
-	(write_init_reg_class_start_regs): Ditto.
-	* genrecog.cc (write_header): Add header file to includes.
-	(printf_indent): Use fprintf.
-	(change_state): Ditto.
-	(print_code): Ditto.
-	(print_host_wide_int): Ditto.
-	(print_parameter_value): Ditto.
-	(print_test_rtx): Ditto.
-	(print_nonbool_test): Ditto.
-	(print_label_value): Ditto.
-	(print_test): Ditto.
-	(print_decision): Ditto.
-	(print_state): Ditto.
-	(print_subroutine_call): Ditto.
-	(print_acceptance): Ditto.
-	(print_subroutine_start): Ditto.
-	(print_pattern): Ditto.
-	(print_subroutine): Ditto.
-	(print_subroutine_group): Ditto.
-	(handle_arg): Add -O and -H for output and header file handling.
-	(main): Use callback.
-	* gentarget-def.cc (def_target_insn): Use fprintf.
-	* read-md.cc (md_reader::print_c_condition): Ditto.
-	* read-md.h (class md_reader): Ditto.
----
- gcc/Makefile.in      |  29 ++-
- gcc/configure        |   4 +-
- gcc/configure.ac     |   4 +-
- gcc/genconditions.cc |   4 +-
- gcc/genpreds.cc      |   4 +-
- gcc/genrecog.cc      | 552 +++++++++++++++++++++++++------------------
- gcc/gentarget-def.cc |   2 +-
- gcc/read-md.cc       |   4 +-
- gcc/read-md.h        |   2 +-
- 9 files changed, 360 insertions(+), 245 deletions(-)
-
-diff --git a/gcc/Makefile.in b/gcc/Makefile.in
-index 27fbbd4bf19e..493ec6a5cb6e 100644
---- a/gcc/Makefile.in
-+++ b/gcc/Makefile.in
-@@ -239,6 +239,12 @@ INSNEMIT_SEQ_SRC = $(patsubst %, insn-emit-%.cc, $(INSNEMIT_SPLITS_SEQ))
- INSNEMIT_SEQ_TMP = $(patsubst %, tmp-emit-%.cc, $(INSNEMIT_SPLITS_SEQ))
- INSNEMIT_SEQ_O = $(patsubst %, insn-emit-%.o, $(INSNEMIT_SPLITS_SEQ))
- 
-+# Re-use the split number for insn-recog as well.
-+INSNRECOG_SPLITS_SEQ = $(wordlist 1,$(NUM_INSNEMIT_SPLITS),$(one_to_9999))
-+INSNRECOG_SEQ_SRC = $(patsubst %, insn-recog-%.cc, $(INSNRECOG_SPLITS_SEQ))
-+INSNRECOG_SEQ_TMP = $(patsubst %, tmp-recog-%.cc, $(INSNRECOG_SPLITS_SEQ))
-+INSNRECOG_SEQ_O = $(patsubst %, insn-recog-%.o, $(INSNRECOG_SPLITS_SEQ))
-+
- # These files are to have specific diagnostics suppressed, or are not to
- # be subject to -Werror:
- # flex output may yield harmless "no previous prototype" warnings
-@@ -1385,7 +1391,7 @@ OBJS = \
- 	insn-output.o \
- 	insn-peep.o \
- 	insn-preds.o \
--	insn-recog.o \
-+	$(INSNRECOG_SEQ_O) \
- 	insn-enums.o \
- 	ggc-page.o \
- 	adjust-alignment.o \
-@@ -1909,8 +1915,8 @@ TREECHECKING = @TREECHECKING@
- FULL_DRIVER_NAME=$(target_noncanonical)-gcc-$(version)$(exeext)
- 
- MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
-- insn-output.cc insn-recog.cc $(INSNEMIT_SEQ_SRC) \
-- insn-extract.cc insn-peep.cc \
-+ insn-output.cc $(INSNRECOG_SEQ_SRC) insn-recog.h \
-+ $(INSNEMIT_SEQ_SRC) insn-extract.cc insn-peep.cc \
-  insn-attr.h insn-attr-common.h insn-attrtab.cc insn-dfatab.cc \
-  insn-latencytab.cc insn-opinit.cc insn-opinit.h insn-preds.cc insn-constants.h \
-  tm-preds.h tm-constrs.h checksum-options $(GIMPLE_MATCH_PD_SEQ_SRC) \
-@@ -2677,7 +2683,8 @@ $(common_out_object_file): $(common_out_file)
- # and compile them.
- 
- .PRECIOUS: insn-config.h insn-flags.h insn-codes.h insn-constants.h \
--  $(INSNEMIT_SEQ_SRC) insn-recog.cc insn-extract.cc insn-output.cc \
-+  $(INSNEMIT_SEQ_SRC) insn-recog.h $(INSNRECOG_SEQ_SRC) \
-+  insn-extract.cc insn-output.cc \
-   insn-peep.cc insn-attr.h insn-attr-common.h insn-attrtab.cc \
-   insn-dfatab.cc insn-latencytab.cc insn-preds.cc \
-   $(GIMPLE_MATCH_PD_SEQ_SRC) $(GENERIC_MATCH_PD_SEQ_SRC) \
-@@ -2706,7 +2713,7 @@ simple_rtl_generated_h	= insn-attr.h insn-attr-common.h insn-codes.h \
- 
- simple_rtl_generated_c	= insn-automata.cc \
- 			  insn-extract.cc insn-output.cc \
--			  insn-peep.cc insn-recog.cc
-+			  insn-peep.cc
- 
- simple_generated_h	= $(simple_rtl_generated_h) insn-constants.h
- 
-@@ -2744,6 +2751,18 @@ s-tmp-emit: build/genemit$(build_exeext) $(MD_DEPS) insn-conditions.md
- 	  insn-emit-$(id).cc;)
- 	$(STAMP) s-tmp-emit
- 
-+# Same for genrecog.
-+$(INSNRECOG_SEQ_SRC): s-tmp-recog; @true
-+insn-recog.h: s-tmp-recog; @true
-+s-tmp-recog: build/genrecog$(build_exeext) $(MD_DEPS) insn-conditions.md
-+	$(RUN_GEN) build/genrecog$(build_exeext) $(md_file) insn-conditions.md \
-+	  -Hinsn-recog.h \
-+	  $(addprefix -O,${INSNRECOG_SEQ_TMP})
-+	$(foreach id, $(INSNRECOG_SPLITS_SEQ), \
-+	  $(SHELL) $(srcdir)/../move-if-change tmp-recog-$(id).cc \
-+	  insn-recog-$(id).cc;)
-+	$(STAMP) s-tmp-recog
-+
- # gencheck doesn't read the machine description, and the file produced
- # doesn't use the insn-* convention.
- 
-diff --git a/gcc/configure b/gcc/configure
-index 0a55fa75573b..a8b531d8fae0 100755
---- a/gcc/configure
-+++ b/gcc/configure
-@@ -1873,7 +1873,7 @@ Optional Packages:
-                           generic when splitting match.pd. [default=10]
-   --with-insnemit-partitions=num
-                           Set the number of partitions of insn-emit.cc for
--                          genemit to create. [default=10]
-+                          genemit and genrecog to create. [default=10]
-   --with-dwarf2           force the default debug format to be DWARF 2 (or
-                           later)
-   --with-specs=SPECS      add SPECS to driver command-line processing
-@@ -7936,7 +7936,7 @@ fi
- 
- 
- 
--# Specify the number of splits of insn-emit.cc to generate.
-+# Specify the number of splits of insn-emit.cc and insn-recog.cc to generate.
- 
- # Check whether --with-insnemit-partitions was given.
- if test "${with_insnemit_partitions+set}" = set; then :
-diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 1a6f01e25675..77fab885a428 100644
---- a/gcc/configure.ac
-+++ b/gcc/configure.ac
-@@ -929,10 +929,10 @@ fi
- 
- AC_SUBST(DEFAULT_MATCHPD_PARTITIONS)
- 
--# Specify the number of splits of insn-emit.cc to generate.
-+# Specify the number of splits of insn-emit.cc and insn-recog.cc to generate.
- AC_ARG_WITH(insnemit-partitions,
- [AS_HELP_STRING([--with-insnemit-partitions=num],
--[Set the number of partitions of insn-emit.cc for genemit to create. [default=10]])],
-+[Set the number of partitions of insn-emit.cc for genemit and genrecog to create. [default=10]])],
- [DEFAULT_INSNEMIT_PARTITIONS="$with_insnemit_partitions"], [DEFAULT_INSNEMIT_PARTITIONS=10])
- if (test $DEFAULT_INSNEMIT_PARTITIONS -lt 1); then
-   AC_MSG_ERROR(m4_normalize([
-diff --git a/gcc/genconditions.cc b/gcc/genconditions.cc
-index 13963dc3ff46..9da460893d52 100644
---- a/gcc/genconditions.cc
-+++ b/gcc/genconditions.cc
-@@ -141,9 +141,9 @@ write_one_condition (void **slot, void * ARG_UNUSED (dummy))
-     }
- 
-   fputs ("\",\n    __builtin_constant_p ", stdout);
--  rtx_reader_ptr->print_c_condition (test->expr);
-+  rtx_reader_ptr->print_c_condition (stdout, test->expr);
-   fputs ("\n    ? (int) ", stdout);
--  rtx_reader_ptr->print_c_condition (test->expr);
-+  rtx_reader_ptr->print_c_condition (stdout, test->expr);
-   fputs ("\n    : -1 },\n", stdout);
-   return 1;
- }
-diff --git a/gcc/genpreds.cc b/gcc/genpreds.cc
-index 55d149e8a404..b8f3bf279d97 100644
---- a/gcc/genpreds.cc
-+++ b/gcc/genpreds.cc
-@@ -538,7 +538,7 @@ write_predicate_expr (rtx exp)
-       break;
- 
-     case MATCH_TEST:
--      rtx_reader_ptr->print_c_condition (XSTR (exp, 0));
-+      rtx_reader_ptr->print_c_condition (stdout, XSTR (exp, 0));
-       break;
- 
-     default:
-@@ -1344,7 +1344,7 @@ write_init_reg_class_start_regs ()
-       for (unsigned int i = 0; i < register_filters.length (); ++i)
- 	{
- 	  printf ("      if (");
--	  rtx_reader_ptr->print_c_condition (register_filters[i]);
-+	  rtx_reader_ptr->print_c_condition (stdout, register_filters[i]);
- 	  printf (")\n"
- 		  "        SET_HARD_REG_BIT (%s[%d], regno);\n",
- 		  "this_target_constraints->register_filters", i);
-diff --git a/gcc/genrecog.cc b/gcc/genrecog.cc
-index 719b1d44387e..1852ceba2513 100644
---- a/gcc/genrecog.cc
-+++ b/gcc/genrecog.cc
-@@ -4255,9 +4255,9 @@ match_pattern (state *s, md_rtx_info *info, rtx pattern,
- /* Begin the output file.  */
- 
- static void
--write_header (void)
-+write_header (FILE *f, const char *header_filename)
- {
--  puts ("\
-+  fprintf (f, "%s", "\
- /* Generated automatically by the program `genrecog' from the target\n\
-    machine description file.  */\n\
- \n\
-@@ -4281,10 +4281,12 @@ write_header (void)
- #include \"diagnostic-core.h\"\n\
- #include \"reload.h\"\n\
- #include \"regs.h\"\n\
--#include \"tm-constrs.h\"\n\
--\n");
-+#include \"tm-constrs.h\"\n");
- 
--  puts ("\n\
-+  fprintf (f, "#include \"%s\"\n", header_filename);
-+  fprintf (f, "%s", "\n");
-+
-+  fprintf (f, "%s", "\n\
- /* `recog' contains a decision tree that recognizes whether the rtx\n\
-    X0 is a valid instruction.\n\
- \n\
-@@ -4293,19 +4295,19 @@ write_header (void)
-    pattern that matched.  This is the same as the order in the machine\n\
-    description of the entry that matched.  This number can be used as an\n\
-    index into `insn_data' and other tables.\n");
--  puts ("\
-+  fprintf (f, "%s", "\
-    The third parameter to recog is an optional pointer to an int.  If\n\
-    present, recog will accept a pattern if it matches except for missing\n\
-    CLOBBER expressions at the end.  In that case, the value pointed to by\n\
-    the optional pointer will be set to the number of CLOBBERs that need\n\
-    to be added (it should be initialized to zero by the caller).  If it");
--  puts ("\
-+  fprintf (f, "%s", "\
-    is set nonzero, the caller should allocate a PARALLEL of the\n\
-    appropriate size, copy the initial entries, and call add_clobbers\n\
-    (found in insn-emit.cc) to fill in the CLOBBERs.\n\
- ");
- 
--  puts ("\n\
-+  fprintf (f, "%s", "\n\
-    The function split_insns returns 0 if the rtl could not\n\
-    be split or the split rtl as an INSN list if it can be.\n\
- \n\
-@@ -4463,13 +4465,13 @@ test_position_available_p (output_state *os, const rtx_test &test)
- 
- /* Like printf, but print INDENT spaces at the beginning.  */
- 
--static void ATTRIBUTE_PRINTF_2
--printf_indent (unsigned int indent, const char *format, ...)
-+static void ATTRIBUTE_PRINTF_3
-+printf_indent (FILE *f, unsigned int indent, const char *format, ...)
- {
-   va_list ap;
-   va_start (ap, format);
--  printf ("%*s", indent, "");
--  vprintf (format, ap);
-+  fprintf (f, "%*s", indent, "");
-+  vfprintf (f, format, ap);
-   va_end (ap);
- }
- 
-@@ -4478,7 +4480,7 @@ printf_indent (unsigned int indent, const char *format, ...)
-    OS with the new state.  */
- 
- static void
--change_state (output_state *os, position *pos, unsigned int indent)
-+change_state (FILE *f, output_state *os, position *pos, unsigned int indent)
- {
-   unsigned int var = os->id_to_var[pos->id];
-   gcc_assert (var < os->var_to_id.length () && os->var_to_id[var] == pos->id);
-@@ -4487,19 +4489,19 @@ change_state (output_state *os, position *pos, unsigned int indent)
-   switch (pos->type)
-     {
-     case POS_PEEP2_INSN:
--      printf_indent (indent, "x%d = PATTERN (peep2_next_insn (%d));\n",
-+      printf_indent (f, indent, "x%d = PATTERN (peep2_next_insn (%d));\n",
- 		     var, pos->arg);
-       break;
- 
-     case POS_XEXP:
--      change_state (os, pos->base, indent);
--      printf_indent (indent, "x%d = XEXP (x%d, %d);\n",
-+      change_state (f, os, pos->base, indent);
-+      printf_indent (f, indent, "x%d = XEXP (x%d, %d);\n",
- 		     var, os->id_to_var[pos->base->id], pos->arg);
-       break;
- 
-     case POS_XVECEXP0:
--      change_state (os, pos->base, indent);
--      printf_indent (indent, "x%d = XVECEXP (x%d, 0, %d);\n",
-+      change_state (f, os, pos->base, indent);
-+      printf_indent (f, indent, "x%d = XVECEXP (x%d, 0, %d);\n",
- 		     var, os->id_to_var[pos->base->id], pos->arg);
-       break;
-     }
-@@ -4510,11 +4512,11 @@ change_state (output_state *os, position *pos, unsigned int indent)
-    the name.  */
- 
- static void
--print_code (enum rtx_code code)
-+print_code (FILE *f, enum rtx_code code)
- {
-   const char *p;
-   for (p = GET_RTX_NAME (code); *p; p++)
--    putchar (TOUPPER (*p));
-+    fprintf (f, "%c", TOUPPER (*p));
- }
- 
- /* Emit a uint64_t as an integer constant expression.  We need to take
-@@ -4522,22 +4524,22 @@ print_code (enum rtx_code code)
-    warnings in the resulting code.  */
- 
- static void
--print_host_wide_int (uint64_t val)
-+print_host_wide_int (FILE *f, uint64_t val)
- {
-   uint64_t min = uint64_t (1) << (HOST_BITS_PER_WIDE_INT - 1);
-   if (val == min)
--    printf ("(" HOST_WIDE_INT_PRINT_DEC_C " - 1)", val + 1);
-+    fprintf (f, "(" HOST_WIDE_INT_PRINT_DEC_C " - 1)", val + 1);
-   else
--    printf (HOST_WIDE_INT_PRINT_DEC_C, val);
-+    fprintf (f, HOST_WIDE_INT_PRINT_DEC_C, val);
- }
- 
- /* Print the C expression for actual parameter PARAM.  */
- 
- static void
--print_parameter_value (const parameter &param)
-+print_parameter_value (FILE *f, const parameter &param)
- {
-   if (param.is_param)
--    printf ("i%d", (int) param.value + 1);
-+    fprintf (f, "i%d", (int) param.value + 1);
-   else
-     switch (param.type)
-       {
-@@ -4546,23 +4548,23 @@ print_parameter_value (const parameter &param)
- 	break;
- 
-       case parameter::CODE:
--	print_code ((enum rtx_code) param.value);
-+	print_code (f, (enum rtx_code) param.value);
- 	break;
- 
-       case parameter::MODE:
--	printf ("E_%smode", GET_MODE_NAME ((machine_mode) param.value));
-+	fprintf (f, "E_%smode", GET_MODE_NAME ((machine_mode) param.value));
- 	break;
- 
-       case parameter::INT:
--	printf ("%d", (int) param.value);
-+	fprintf (f, "%d", (int) param.value);
- 	break;
- 
-       case parameter::UINT:
--	printf ("%u", (unsigned int) param.value);
-+	fprintf (f, "%u", (unsigned int) param.value);
- 	break;
- 
-       case parameter::WIDE_INT:
--	print_host_wide_int (param.value);
-+	print_host_wide_int (f, param.value);
- 	break;
-       }
- }
-@@ -4570,90 +4572,90 @@ print_parameter_value (const parameter &param)
- /* Print the C expression for the rtx tested by TEST.  */
- 
- static void
--print_test_rtx (output_state *os, const rtx_test &test)
-+print_test_rtx (FILE *f, output_state *os, const rtx_test &test)
- {
-   if (test.pos_operand >= 0)
--    printf ("operands[%d]", test.pos_operand);
-+    fprintf (f, "operands[%d]", test.pos_operand);
-   else
--    printf ("x%d", os->id_to_var[test.pos->id]);
-+    fprintf (f, "x%d", os->id_to_var[test.pos->id]);
- }
- 
- /* Print the C expression for non-boolean test TEST.  */
- 
- static void
--print_nonbool_test (output_state *os, const rtx_test &test)
-+print_nonbool_test (FILE *f, output_state *os, const rtx_test &test)
- {
-   switch (test.kind)
-     {
-     case rtx_test::CODE:
--      printf ("GET_CODE (");
--      print_test_rtx (os, test);
--      printf (")");
-+      fprintf (f, "GET_CODE (");
-+      print_test_rtx (f, os, test);
-+      fprintf (f, ")");
-       break;
- 
-     case rtx_test::MODE:
--      printf ("GET_MODE (");
--      print_test_rtx (os, test);
--      printf (")");
-+      fprintf (f, "GET_MODE (");
-+      print_test_rtx (f, os, test);
-+      fprintf (f, ")");
-       break;
- 
-     case rtx_test::VECLEN:
--      printf ("XVECLEN (");
--      print_test_rtx (os, test);
--      printf (", 0)");
-+      fprintf (f, "XVECLEN (");
-+      print_test_rtx (f, os, test);
-+      fprintf (f, ", 0)");
-       break;
- 
-     case rtx_test::INT_FIELD:
--      printf ("XINT (");
--      print_test_rtx (os, test);
--      printf (", %d)", test.u.opno);
-+      fprintf (f, "XINT (");
-+      print_test_rtx (f, os, test);
-+      fprintf (f, ", %d)", test.u.opno);
-       break;
- 
-     case rtx_test::REGNO_FIELD:
--      printf ("REGNO (");
--      print_test_rtx (os, test);
--      printf (")");
-+      fprintf (f, "REGNO (");
-+      print_test_rtx (f, os, test);
-+      fprintf (f, ")");
-       break;
- 
-     case rtx_test::SUBREG_FIELD:
--      printf ("SUBREG_BYTE (");
--      print_test_rtx (os, test);
--      printf (")");
-+      fprintf (f, "SUBREG_BYTE (");
-+      print_test_rtx (f, os, test);
-+      fprintf (f, ")");
-       break;
- 
-     case rtx_test::WIDE_INT_FIELD:
--      printf ("XWINT (");
--      print_test_rtx (os, test);
--      printf (", %d)", test.u.opno);
-+      fprintf (f, "XWINT (");
-+      print_test_rtx (f, os, test);
-+      fprintf (f, ", %d)", test.u.opno);
-       break;
- 
-     case rtx_test::PATTERN:
-       {
- 	pattern_routine *routine = test.u.pattern->routine;
--	printf ("pattern%d (", routine->pattern_id);
-+	fprintf (f, "pattern%d (", routine->pattern_id);
- 	const char *sep = "";
- 	if (test.pos)
- 	  {
--	    print_test_rtx (os, test);
-+	    print_test_rtx (f, os, test);
- 	    sep = ", ";
- 	  }
- 	if (routine->insn_p)
- 	  {
--	    printf ("%sinsn", sep);
-+	    fprintf (f, "%sinsn", sep);
- 	    sep = ", ";
- 	  }
- 	if (routine->pnum_clobbers_p)
- 	  {
--	    printf ("%spnum_clobbers", sep);
-+	    fprintf (f, "%spnum_clobbers", sep);
- 	    sep = ", ";
- 	  }
- 	for (unsigned int i = 0; i < test.u.pattern->params.length (); ++i)
- 	  {
--	    fputs (sep, stdout);
--	    print_parameter_value (test.u.pattern->params[i]);
-+	    fprintf (f, "%s\n", sep);
-+	    print_parameter_value (f, test.u.pattern->params[i]);
- 	    sep = ", ";
- 	  }
--	printf (")");
-+	fprintf (f, ")");
- 	break;
-       }
- 
-@@ -4674,10 +4676,11 @@ print_nonbool_test (output_state *os, const rtx_test &test)
-    decision performs TEST.  Print the C code for the label.  */
- 
- static void
--print_label_value (const rtx_test &test, bool is_param, uint64_t value)
-+print_label_value (FILE *f, const rtx_test &test, bool is_param,
-+		   uint64_t value)
- {
--  print_parameter_value (parameter (transition_parameter_type (test.kind),
--				    is_param, value));
-+  print_parameter_value (f, parameter (transition_parameter_type (test.kind),
-+				       is_param, value));
- }
- 
- /* If IS_PARAM, print code to compare TEST with the C variable i<VALUE+1>.
-@@ -4685,7 +4688,7 @@ print_label_value (const rtx_test &test, bool is_param, uint64_t value)
-    Test for inequality if INVERT_P, otherwise test for equality.  */
- 
- static void
--print_test (output_state *os, const rtx_test &test, bool is_param,
-+print_test (FILE *f, output_state *os, const rtx_test &test, bool is_param,
- 	    uint64_t value, bool invert_p)
- {
-   switch (test.kind)
-@@ -4698,71 +4701,71 @@ print_test (output_state *os, const rtx_test &test, bool is_param,
-     case rtx_test::INT_FIELD:
-     case rtx_test::WIDE_INT_FIELD:
-     case rtx_test::PATTERN:
--      print_nonbool_test (os, test);
--      printf (" %s ", invert_p ? "!=" : "==");
--      print_label_value (test, is_param, value);
-+      print_nonbool_test (f, os, test);
-+      fprintf (f, " %s ", invert_p ? "!=" : "==");
-+      print_label_value (f, test, is_param, value);
-       break;
- 
-     case rtx_test::SUBREG_FIELD:
--      printf ("%s (", invert_p ? "maybe_ne" : "known_eq");
--      print_nonbool_test (os, test);
--      printf (", ");
--      print_label_value (test, is_param, value);
--      printf (")");
-+      fprintf (f, "%s (", invert_p ? "maybe_ne" : "known_eq");
-+      print_nonbool_test (f, os, test);
-+      fprintf (f, ", ");
-+      print_label_value (f, test, is_param, value);
-+      fprintf (f, ")");
-       break;
- 
-     case rtx_test::SAVED_CONST_INT:
-       gcc_assert (!is_param && value == 1);
--      print_test_rtx (os, test);
--      printf (" %s const_int_rtx[MAX_SAVED_CONST_INT + ",
--	      invert_p ? "!=" : "==");
--      print_parameter_value (parameter (parameter::INT,
--					test.u.integer.is_param,
--					test.u.integer.value));
--      printf ("]");
-+      print_test_rtx (f, os, test);
-+      fprintf (f, " %s const_int_rtx[MAX_SAVED_CONST_INT + ",
-+	       invert_p ? "!=" : "==");
-+      print_parameter_value (f, parameter (parameter::INT,
-+					   test.u.integer.is_param,
-+					   test.u.integer.value));
-+      fprintf (f, "]");
-       break;
- 
-     case rtx_test::PEEP2_COUNT:
-       gcc_assert (!is_param && value == 1);
--      printf ("peep2_current_count %s %d", invert_p ? "<" : ">=",
--	      test.u.min_len);
-+      fprintf (f, "peep2_current_count %s %d", invert_p ? "<" : ">=",
-+	       test.u.min_len);
-       break;
- 
-     case rtx_test::VECLEN_GE:
-       gcc_assert (!is_param && value == 1);
--      printf ("XVECLEN (");
--      print_test_rtx (os, test);
--      printf (", 0) %s %d", invert_p ? "<" : ">=", test.u.min_len);
-+      fprintf (f, "XVECLEN (");
-+      print_test_rtx (f, os, test);
-+      fprintf (f, ", 0) %s %d", invert_p ? "<" : ">=", test.u.min_len);
-       break;
- 
-     case rtx_test::PREDICATE:
-       gcc_assert (!is_param && value == 1);
--      printf ("%s%s (", invert_p ? "!" : "", test.u.predicate.data->name);
--      print_test_rtx (os, test);
--      printf (", ");
--      print_parameter_value (parameter (parameter::MODE,
--					test.u.predicate.mode_is_param,
--					test.u.predicate.mode));
--      printf (")");
-+      fprintf (f, "%s%s (", invert_p ? "!" : "", test.u.predicate.data->name);
-+      print_test_rtx (f, os, test);
-+      fprintf (f, ", ");
-+      print_parameter_value (f, parameter (parameter::MODE,
-+					   test.u.predicate.mode_is_param,
-+					   test.u.predicate.mode));
-+      fprintf (f, ")");
-       break;
- 
-     case rtx_test::DUPLICATE:
-       gcc_assert (!is_param && value == 1);
--      printf ("%srtx_equal_p (", invert_p ? "!" : "");
--      print_test_rtx (os, test);
--      printf (", operands[%d])", test.u.opno);
-+      fprintf (f, "%srtx_equal_p (", invert_p ? "!" : "");
-+      print_test_rtx (f, os, test);
-+      fprintf (f, ", operands[%d])", test.u.opno);
-       break;
- 
-     case rtx_test::HAVE_NUM_CLOBBERS:
-       gcc_assert (!is_param && value == 1);
--      printf ("pnum_clobbers %s NULL", invert_p ? "==" : "!=");
-+      fprintf (f, "pnum_clobbers %s NULL", invert_p ? "==" : "!=");
-       break;
- 
-     case rtx_test::C_TEST:
-       gcc_assert (!is_param && value == 1);
-       if (invert_p)
--	printf ("!");
--      rtx_reader_ptr->print_c_condition (test.u.string);
-+	fprintf (f, "!");
-+      rtx_reader_ptr->print_c_condition (f, test.u.string);
-       break;
- 
-     case rtx_test::ACCEPT:
-@@ -4771,7 +4774,7 @@ print_test (output_state *os, const rtx_test &test, bool is_param,
-     }
- }
- 
--static exit_state print_decision (output_state *, decision *,
-+static exit_state print_decision (FILE *f, output_state *, decision *,
- 				  unsigned int, bool);
- 
- /* Print code to perform S, indent each line by INDENT spaces.
-@@ -4779,14 +4782,15 @@ static exit_state print_decision (output_state *, decision *,
-    if the state fails then the entire routine fails.  */
- 
- static exit_state
--print_state (output_state *os, state *s, unsigned int indent, bool is_final)
-+print_state (FILE *f, output_state *os, state *s, unsigned int indent,
-+	     bool is_final)
- {
-   exit_state es = ES_FALLTHROUGH;
-   for (decision *d = s->first; d; d = d->next)
--    es = print_decision (os, d, indent, is_final && !d->next);
-+    es = print_decision (f, os, d, indent, is_final && !d->next);
-   if (es != ES_RETURNED && is_final)
-     {
--      printf_indent (indent, "return %s;\n", get_failure_return (os->type));
-+      printf_indent (f, indent, "return %s;\n", get_failure_return (os->type));
-       es = ES_RETURNED;
-     }
-   return es;
-@@ -4797,7 +4801,7 @@ print_state (output_state *os, state *s, unsigned int indent, bool is_final)
-    match.  */
- 
- static const char *
--print_subroutine_call (const acceptance_type &acceptance)
-+print_subroutine_call (FILE *f, const acceptance_type &acceptance)
- {
-   switch (acceptance.type)
-     {
-@@ -4805,17 +4809,17 @@ print_subroutine_call (const acceptance_type &acceptance)
-       gcc_unreachable ();
- 
-     case RECOG:
--      printf ("recog_%d (x1, insn, pnum_clobbers)",
--	      acceptance.u.subroutine_id);
-+      fprintf (f, "recog_%d (x1, insn, pnum_clobbers)",
-+	       acceptance.u.subroutine_id);
-       return ">= 0";
- 
-     case SPLIT:
--      printf ("split_%d (x1, insn)", acceptance.u.subroutine_id);
-+      fprintf (f, "split_%d (x1, insn)", acceptance.u.subroutine_id);
-       return "!= NULL_RTX";
- 
-     case PEEPHOLE2:
--      printf ("peephole2_%d (x1, insn, pmatch_len_)",
--	      acceptance.u.subroutine_id);
-+      fprintf (f, "peephole2_%d (x1, insn, pmatch_len_)",
-+	       acceptance.u.subroutine_id);
-       return "!= NULL_RTX";
-     }
-   gcc_unreachable ();
-@@ -4825,63 +4829,65 @@ print_subroutine_call (const acceptance_type &acceptance)
-    INDENT and IS_FINAL are as for print_state.  */
- 
- static exit_state
--print_acceptance (const acceptance_type &acceptance, unsigned int indent,
--		  bool is_final)
-+print_acceptance (FILE *f, const acceptance_type &acceptance,
-+		  unsigned int indent, bool is_final)
- {
-   if (acceptance.partial_p)
-     {
-       /* Defer the rest of the match to a subroutine.  */
-       if (is_final)
- 	{
--	  printf_indent (indent, "return ");
--	  print_subroutine_call (acceptance);
--	  printf (";\n");
-+	  printf_indent (f, indent, "return ");
-+	  print_subroutine_call (f, acceptance);
-+	  fprintf (f, ";\n");
- 	  return ES_RETURNED;
- 	}
-       else
- 	{
--	  printf_indent (indent, "res = ");
--	  const char *res_test = print_subroutine_call (acceptance);
--	  printf (";\n");
--	  printf_indent (indent, "if (res %s)\n", res_test);
--	  printf_indent (indent + 2, "return res;\n");
-+	  printf_indent (f, indent, "res = ");
-+	  const char *res_test = print_subroutine_call (f, acceptance);
-+	  fprintf (f, ";\n");
-+	  printf_indent (f, indent, "if (res %s)\n", res_test);
-+	  printf_indent (f, indent + 2, "return res;\n");
- 	  return ES_FALLTHROUGH;
- 	}
-     }
-   switch (acceptance.type)
-     {
-     case SUBPATTERN:
--      printf_indent (indent, "return %d;\n", acceptance.u.full.code);
-+      printf_indent (f, indent, "return %d;\n", acceptance.u.full.code);
-       return ES_RETURNED;
- 
-     case RECOG:
-       if (acceptance.u.full.u.num_clobbers != 0)
--	printf_indent (indent, "*pnum_clobbers = %d;\n",
-+	printf_indent (f, indent, "*pnum_clobbers = %d;\n",
- 		       acceptance.u.full.u.num_clobbers);
--      printf_indent (indent, "return %d; /* %s */\n", acceptance.u.full.code,
-+      printf_indent (f, indent, "return %d; /* %s */\n", acceptance.u.full.code,
- 		     get_insn_name (acceptance.u.full.code));
-       return ES_RETURNED;
- 
-     case SPLIT:
--      printf_indent (indent, "return gen_split_%d (insn, operands);\n",
-+      printf_indent (f, indent, "return gen_split_%d (insn, operands);\n",
- 		     acceptance.u.full.code);
-       return ES_RETURNED;
- 
-     case PEEPHOLE2:
--      printf_indent (indent, "*pmatch_len_ = %d;\n",
-+      printf_indent (f, indent, "*pmatch_len_ = %d;\n",
- 		     acceptance.u.full.u.match_len);
-       if (is_final)
- 	{
--	  printf_indent (indent, "return gen_peephole2_%d (insn, operands);\n",
-+	  printf_indent (f, indent,
-+			 "return gen_peephole2_%d (insn, operands);\n",
- 			 acceptance.u.full.code);
- 	  return ES_RETURNED;
- 	}
-       else
- 	{
--	  printf_indent (indent, "res = gen_peephole2_%d (insn, operands);\n",
-+	  printf_indent (f,
-+			 indent, "res = gen_peephole2_%d (insn, operands);\n",
- 			 acceptance.u.full.code);
--	  printf_indent (indent, "if (res != NULL_RTX)\n");
--	  printf_indent (indent + 2, "return res;\n");
-+	  printf_indent (f, indent, "if (res != NULL_RTX)\n");
-+	  printf_indent (f, indent + 2, "return res;\n");
- 	  return ES_FALLTHROUGH;
- 	}
-     }
-@@ -4891,7 +4897,7 @@ print_acceptance (const acceptance_type &acceptance, unsigned int indent,
- /* Print code to perform D.  INDENT and IS_FINAL are as for print_state.  */
- 
- static exit_state
--print_decision (output_state *os, decision *d, unsigned int indent,
-+print_decision (FILE *f, output_state *os, decision *d, unsigned int indent,
- 		bool is_final)
- {
-   uint64_t label;
-@@ -4900,7 +4906,7 @@ print_decision (output_state *os, decision *d, unsigned int indent,
-   /* Make sure the rtx under test is available either in operands[] or
-      in an xN variable.  */
-   if (d->test.pos && d->test.pos_operand < 0)
--    change_state (os, d->test.pos, indent);
-+    change_state (f, os, d->test.pos, indent);
- 
-   /* Look for cases where a pattern routine P1 calls another pattern routine
-      P2 and where P1 returns X + BASE whenever P2 returns X.  If IS_FINAL
-@@ -4924,32 +4930,32 @@ print_decision (output_state *os, decision *d, unsigned int indent,
-     {
-       if (is_final && base == 0)
- 	{
--	  printf_indent (indent, "return ");
--	  print_nonbool_test (os, d->test);
--	  printf ("; /* [-1, %d] */\n", count - 1);
-+	  printf_indent (f, indent, "return ");
-+	  print_nonbool_test (f, os, d->test);
-+	  fprintf (f, "; /* [-1, %d] */\n", count - 1);
- 	  return ES_RETURNED;
- 	}
-       else
- 	{
--	  printf_indent (indent, "res = ");
--	  print_nonbool_test (os, d->test);
--	  printf (";\n");
--	  printf_indent (indent, "if (res >= 0)\n");
--	  printf_indent (indent + 2, "return res");
-+	  printf_indent (f, indent, "res = ");
-+	  print_nonbool_test (f, os, d->test);
-+	  fprintf (f, ";\n");
-+	  printf_indent (f, indent, "if (res >= 0)\n");
-+	  printf_indent (f, indent + 2, "return res");
- 	  if (base != 0)
--	    printf (" + %d", base);
--	  printf ("; /* [%d, %d] */\n", base, base + count - 1);
-+	    fprintf (f, " + %d", base);
-+	  fprintf (f, "; /* [%d, %d] */\n", base, base + count - 1);
- 	  return ES_FALLTHROUGH;
- 	}
-     }
-   else if (d->test.kind == rtx_test::ACCEPT)
--    return print_acceptance (d->test.u.acceptance, indent, is_final);
-+    return print_acceptance (f, d->test.u.acceptance, indent, is_final);
-   else if (d->test.kind == rtx_test::SET_OP)
-     {
--      printf_indent (indent, "operands[%d] = ", d->test.u.opno);
--      print_test_rtx (os, d->test);
--      printf (";\n");
--      return print_state (os, d->singleton ()->to, indent, is_final);
-+      printf_indent (f, indent, "operands[%d] = ", d->test.u.opno);
-+      print_test_rtx (f, os, d->test);
-+      fprintf (f, ";\n");
-+      return print_state (f, os, d->singleton ()->to, indent, is_final);
-     }
-   /* Handle decisions with a single transition and a single transition
-      label.  */
-@@ -4957,13 +4963,13 @@ print_decision (output_state *os, decision *d, unsigned int indent,
-     {
-       transition *trans = d->singleton ();
-       if (mark_optional_transitions_p && trans->optional)
--	printf_indent (indent, "/* OPTIONAL IF */\n");
-+	printf_indent (f, indent, "/* OPTIONAL IF */\n");
- 
-       /* Print the condition associated with TRANS.  Invert it if IS_FINAL,
- 	 so that we return immediately on failure and fall through on
- 	 success.  */
--      printf_indent (indent, "if (");
--      print_test (os, d->test, trans->is_param, label, is_final);
-+      printf_indent (f, indent, "if (");
-+      print_test (f, os, d->test, trans->is_param, label, is_final);
- 
-       /* Look for following states that would be handled by this code
- 	 on recursion.  If they don't need any preparatory statements,
-@@ -4979,13 +4985,13 @@ print_decision (output_state *os, decision *d, unsigned int indent,
- 	      || !test_position_available_p (os, d->test))
- 	    break;
- 	  trans = d->first;
--	  printf ("\n");
-+	  fprintf (f, "\n");
- 	  if (mark_optional_transitions_p && trans->optional)
--	    printf_indent (indent + 4, "/* OPTIONAL IF */\n");
--	  printf_indent (indent + 4, "%s ", is_final ? "||" : "&&");
--	  print_test (os, d->test, trans->is_param, label, is_final);
-+	    printf_indent (f, indent + 4, "/* OPTIONAL IF */\n");
-+	  printf_indent (f, indent + 4, "%s ", is_final ? "||" : "&&");
-+	  print_test (f, os, d->test, trans->is_param, label, is_final);
- 	}
--      printf (")\n");
-+      fprintf (f, ")\n");
- 
-       /* Print the conditional code with INDENT + 2 and the fallthrough
- 	 code with indent INDENT.  */
-@@ -4994,9 +5000,9 @@ print_decision (output_state *os, decision *d, unsigned int indent,
- 	{
- 	  /* We inverted the condition above, so return failure in the
- 	     "if" body and fall through to the target of the transition.  */
--	  printf_indent (indent + 2, "return %s;\n",
-+	  printf_indent (f, indent + 2, "return %s;\n",
- 			 get_failure_return (os->type));
--	  return print_state (os, to, indent, is_final);
-+	  return print_state (f, os, to, indent, is_final);
- 	}
-       else if (to->singleton ()
- 	       && to->first->test.kind == rtx_test::ACCEPT
-@@ -5004,7 +5010,7 @@ print_decision (output_state *os, decision *d, unsigned int indent,
- 	{
- 	  /* The target of the transition is a simple "return" statement.
- 	     It doesn't need any braces and doesn't fall through.  */
--	  if (print_acceptance (to->first->test.u.acceptance,
-+	  if (print_acceptance (f, to->first->test.u.acceptance,
- 				indent + 2, true) != ES_RETURNED)
- 	    gcc_unreachable ();
- 	  return ES_FALLTHROUGH;
-@@ -5018,9 +5024,9 @@ print_decision (output_state *os, decision *d, unsigned int indent,
- 	  auto_vec <bool, 32> old_seen;
- 	  old_seen.safe_splice (os->seen_vars);
- 
--	  printf_indent (indent + 2, "{\n");
--	  print_state (os, trans->to, indent + 4, is_final);
--	  printf_indent (indent + 2, "}\n");
-+	  printf_indent (f, indent + 2, "{\n");
-+	  print_state (f, os, trans->to, indent + 4, is_final);
-+	  printf_indent (f, indent + 2, "}\n");
- 
- 	  os->seen_vars.truncate (0);
- 	  os->seen_vars.splice (old_seen);
-@@ -5030,48 +5036,48 @@ print_decision (output_state *os, decision *d, unsigned int indent,
-   else
-     {
-       /* Output the decision as a switch statement.  */
--      printf_indent (indent, "switch (");
--      print_nonbool_test (os, d->test);
--      printf (")\n");
-+      printf_indent (f, indent, "switch (");
-+      print_nonbool_test (f, os, d->test);
-+      fprintf (f, ")\n");
- 
-       /* Each case statement starts with the same set of valid variables.
- 	 These are also the only variables will be valid on fallthrough.  */
-       auto_vec <bool, 32> old_seen;
-       old_seen.safe_splice (os->seen_vars);
- 
--      printf_indent (indent + 2, "{\n");
-+      printf_indent (f, indent + 2, "{\n");
-       for (transition *trans = d->first; trans; trans = trans->next)
- 	{
- 	  gcc_assert (!trans->is_param);
- 	  if (mark_optional_transitions_p && trans->optional)
--	    printf_indent (indent + 2, "/* OPTIONAL CASE */\n");
-+	    printf_indent (f, indent + 2, "/* OPTIONAL CASE */\n");
- 	  for (int_set::iterator j = trans->labels.begin ();
- 	       j != trans->labels.end (); ++j)
- 	    {
--	      printf_indent (indent + 2, "case ");
--	      print_label_value (d->test, trans->is_param, *j);
--	      printf (":\n");
-+	      printf_indent (f, indent + 2, "case ");
-+	      print_label_value (f, d->test, trans->is_param, *j);
-+	      fprintf (f, ":\n");
- 	    }
--	  if (print_state (os, trans->to, indent + 4, is_final))
-+	  if (print_state (f, os, trans->to, indent + 4, is_final))
- 	    {
- 	      /* The state can fall through.  Add an explicit break.  */
- 	      gcc_assert (!is_final);
--	      printf_indent (indent + 4, "break;\n");
-+	      printf_indent (f, indent + 4, "break;\n");
- 	    }
--	  printf ("\n");
-+	  fprintf (f, "\n");
- 
- 	  /* Restore the original set of valid variables.  */
- 	  os->seen_vars.truncate (0);
- 	  os->seen_vars.splice (old_seen);
- 	}
-       /* Add a default case.  */
--      printf_indent (indent + 2, "default:\n");
-+      printf_indent (f, indent + 2, "default:\n");
-       if (is_final)
--	printf_indent (indent + 4, "return %s;\n",
-+	printf_indent (f, indent + 4, "return %s;\n",
- 		       get_failure_return (os->type));
-       else
--	printf_indent (indent + 4, "break;\n");
--      printf_indent (indent + 2, "}\n");
-+	printf_indent (f, indent + 4, "break;\n");
-+      printf_indent (f, indent + 2, "}\n");
-       return is_final ? ES_RETURNED : ES_FALLTHROUGH;
-     }
- }
-@@ -5114,10 +5120,10 @@ assign_position_vars (output_state *os, state *s)
-    only ROOT's variable has a valid value.  */
- 
- static void
--print_subroutine_start (output_state *os, state *s, position *root)
-+print_subroutine_start (FILE *f, output_state *os, state *s, position *root)
- {
--  printf ("{\n  rtx * const operands ATTRIBUTE_UNUSED"
--	  " = &recog_data.operand[0];\n");
-+  fprintf (f, "{\n  rtx * const operands ATTRIBUTE_UNUSED"
-+	   " = &recog_data.operand[0];\n");
-   os->var_to_id.truncate (0);
-   os->seen_vars.truncate (0);
-   if (root)
-@@ -5140,9 +5146,9 @@ print_subroutine_start (output_state *os, state *s, position *root)
- 	{
- 	  for (unsigned int i = 2; i < num_vars; ++i)
- 	    /* Print 8 rtx variables to a line.  */
--	    printf ("%s x%d",
-+	    fprintf (f, "%s x%d",
- 		    i == 2 ? "  rtx" : (i - 2) % 8 == 0 ? ";\n  rtx" : ",", i);
--	  printf (";\n");
-+	  fprintf (f, ";\n");
- 	}
- 
-       /* Say that x1 is valid and the rest aren't.  */
-@@ -5150,22 +5156,26 @@ print_subroutine_start (output_state *os, state *s, position *root)
-       os->seen_vars[1] = true;
-     }
-   if (os->type == SUBPATTERN || os->type == RECOG)
--    printf ("  int res ATTRIBUTE_UNUSED;\n");
-+    fprintf (f, "  int res ATTRIBUTE_UNUSED;\n");
-   else
--    printf ("  rtx_insn *res ATTRIBUTE_UNUSED;\n");
-+    fprintf (f, "  rtx_insn *res ATTRIBUTE_UNUSED;\n");
- }
- 
- /* Output the definition of pattern routine ROUTINE.  */
- 
- static void
--print_pattern (output_state *os, pattern_routine *routine)
-+print_pattern (FILE *f, output_state *os, pattern_routine *routine,
-+	       bool in_header = false)
- {
--  printf ("\nstatic int\npattern%d (", routine->pattern_id);
-+  if (!in_header)
-+    fprintf (f, "\nint\npattern%d (", routine->pattern_id);
-+  else
-+    fprintf (f, "\nextern int\npattern%d (", routine->pattern_id);
-   const char *sep = "";
-   /* Add the top-level rtx parameter, if any.  */
-   if (routine->pos)
-     {
--      printf ("%srtx x1", sep);
-+      fprintf (f, "%srtx x1", sep);
-       sep = ", ";
-     }
-   /* Add the optional parameters.  */
-@@ -5173,26 +5183,34 @@ print_pattern (output_state *os, pattern_routine *routine)
-     {
-       /* We can't easily tell whether a C condition actually reads INSN,
- 	 so add an ATTRIBUTE_UNUSED just in case.  */
--      printf ("%srtx_insn *insn ATTRIBUTE_UNUSED", sep);
-+      fprintf (f, "%srtx_insn *insn ATTRIBUTE_UNUSED", sep);
-       sep = ", ";
-     }
-   if (routine->pnum_clobbers_p)
-     {
--      printf ("%sint *pnum_clobbers", sep);
-+      fprintf (f, "%sint *pnum_clobbers", sep);
-       sep = ", ";
-     }
-   /* Add the "i" parameters.  */
-   for (unsigned int i = 0; i < routine->param_types.length (); ++i)
-     {
--      printf ("%s%s i%d", sep,
--	      parameter_type_string (routine->param_types[i]), i + 1);
-+      fprintf (f, "%s%s i%d", sep,
-+	       parameter_type_string (routine->param_types[i]), i + 1);
-       sep = ", ";
-     }
--  printf (")\n");
-+
-+  if (!in_header)
-+    fprintf (f, ")\n");
-+  else
-+    {
-+      fprintf (f, ");\n");
-+      return;
-+    }
-+
-   os->type = SUBPATTERN;
--  print_subroutine_start (os, routine->s, routine->pos);
--  print_state (os, routine->s, 2, true);
--  printf ("}\n");
-+  print_subroutine_start (f, os, routine->s, routine->pos);
-+  print_state (f, os, routine->s, 2, true);
-+  fprintf (f, "}\n");
- }
- 
- /* Output a routine of type TYPE that implements S.  PROC_ID is the
-@@ -5200,9 +5218,26 @@ print_pattern (output_state *os, pattern_routine *routine)
-    routine.  */
- 
- static void
--print_subroutine (output_state *os, state *s, int proc_id)
--{
--  printf ("\n");
-+print_subroutine (FILE *f, output_state *os, state *s, int proc_id,
-+		  bool in_header = false)
-+{
-+  fprintf (f, "\n");
-+  const char *specifier_ext = "extern";
-+  const char *specifier_default = "";
-+  const char *specifier;
-+  if (!in_header)
-+    specifier = specifier_default;
-+  else
-+    specifier = specifier_ext;
-+
-+  const char *end;
-+  const char *end_default = "";
-+  const char *end_header = ";";
-+  if (!in_header)
-+    end = end_default;
-+  else
-+    end = end_header;
-+
-   switch (os->type)
-     {
-     case SUBPATTERN:
-@@ -5210,46 +5245,54 @@ print_subroutine (output_state *os, state *s, int proc_id)
- 
-     case RECOG:
-       if (proc_id)
--	printf ("static int\nrecog_%d", proc_id);
-+	fprintf (f, "%s int\nrecog_%d", specifier, proc_id);
-       else
--	printf ("int\nrecog");
--      printf (" (rtx x1 ATTRIBUTE_UNUSED,\n"
--	      "\trtx_insn *insn ATTRIBUTE_UNUSED,\n"
--	      "\tint *pnum_clobbers ATTRIBUTE_UNUSED)\n");
-+	fprintf (f, "%s int\nrecog", specifier);
-+      fprintf (f, " (rtx x1 ATTRIBUTE_UNUSED,\n"
-+	       "\trtx_insn *insn ATTRIBUTE_UNUSED,\n"
-+	       "\tint *pnum_clobbers ATTRIBUTE_UNUSED)%s\n", end);
-       break;
- 
-     case SPLIT:
-       if (proc_id)
--	printf ("static rtx_insn *\nsplit_%d", proc_id);
-+	fprintf (f, "%s rtx_insn *\nsplit_%d", specifier, proc_id);
-       else
--	printf ("rtx_insn *\nsplit_insns");
--      printf (" (rtx x1 ATTRIBUTE_UNUSED, rtx_insn *insn ATTRIBUTE_UNUSED)\n");
-+	fprintf (f, "%s rtx_insn *\nsplit_insns", specifier);
-+      fprintf (f, " (rtx x1 ATTRIBUTE_UNUSED, "
-+		  "rtx_insn *insn ATTRIBUTE_UNUSED)%s\n", end);
-       break;
- 
-     case PEEPHOLE2:
-       if (proc_id)
--	printf ("static rtx_insn *\npeephole2_%d", proc_id);
-+	fprintf (f, "%s rtx_insn *\npeephole2_%d", specifier, proc_id);
-       else
--	printf ("rtx_insn *\npeephole2_insns");
--      printf (" (rtx x1 ATTRIBUTE_UNUSED,\n"
--	      "\trtx_insn *insn ATTRIBUTE_UNUSED,\n"
--	      "\tint *pmatch_len_ ATTRIBUTE_UNUSED)\n");
-+	fprintf (f, "%s rtx_insn *\npeephole2_insns", specifier);
-+      fprintf (f, " (rtx x1 ATTRIBUTE_UNUSED,\n"
-+	       "\trtx_insn *insn ATTRIBUTE_UNUSED,\n"
-+	       "\tint *pmatch_len_ ATTRIBUTE_UNUSED)%s\n", end);
-       break;
-     }
--  print_subroutine_start (os, s, &root_pos);
-+
-+  if (in_header)
-+    return;
-+
-+  print_subroutine_start (f, os, s, &root_pos);
-   if (proc_id == 0)
-     {
--      printf ("  recog_data.insn = NULL;\n");
-+      fprintf (f, "  recog_data.insn = NULL;\n");
-     }
--  print_state (os, s, 2, true);
--  printf ("}\n");
-+  print_state (f, os, s, 2, true);
-+  fprintf (f, "}\n");
- }
- 
- /* Print out a routine of type TYPE that performs ROOT.  */
- 
- static void
--print_subroutine_group (output_state *os, routine_type type, state *root)
-+print_subroutine_group (vec<FILE *> &vec, FILE *header, output_state *os,
-+			routine_type type, state *root)
- {
-+  FILE *f;
-+  unsigned idx;
-   os->type = type;
-   if (use_subroutines_p)
-     {
-@@ -5261,11 +5304,20 @@ print_subroutine_group (output_state *os, routine_type type, state *root)
-       /* Output the subroutines (but not ROOT itself).  */
-       unsigned int i;
-       state *s;
-+
-+      FILE *f = header;
-+      FOR_EACH_VEC_ELT (subroutines, i, s)
-+	print_subroutine (header, os, s, i + 1, true);
-+
-       FOR_EACH_VEC_ELT (subroutines, i, s)
--	print_subroutine (os, s, i + 1);
-+	{
-+	  f = choose_output (vec, idx);
-+	  print_subroutine (f, os, s, i + 1);
-+	}
-     }
-   /* Output the main routine.  */
--  print_subroutine (os, root, 0);
-+  f = choose_output (vec, idx);
-+  print_subroutine (f, os, root, 0);
- }
- 
- /* Return the rtx pattern for the list of rtxes in a define_peephole2.  */
-@@ -5336,6 +5388,29 @@ remove_clobbers (acceptance_type *acceptance_ptr, rtx *pattern_ptr)
-   return true;
- }
- 
-+auto_vec<FILE *, 10> output_files;
-+char header_name[255];
-+FILE *header = NULL;
-+
-+static bool
-+handle_arg (const char *arg)
-+{
-+  printf ("%s\n", arg);
-+  if (arg[1] == 'O')
-+    {
-+      FILE *file = fopen (&arg[2], "w");
-+      output_files.safe_push (file);
-+      return true;
-+    }
-+  if (arg[1] == 'H')
-+    {
-+      snprintf (header_name, 255, "%s", &arg[2]);
-+      header = fopen (header_name, "w");
-+      return true;
-+    }
-+  return false;
-+}
-+
- int
- main (int argc, const char **argv)
- {
-@@ -5343,10 +5418,17 @@ main (int argc, const char **argv)
- 
-   progname = "genrecog";
- 
--  if (!init_rtx_reader_args (argc, argv))
-+  if (!init_rtx_reader_args_cb (argc, argv, handle_arg))
-     return (FATAL_EXIT_CODE);
- 
--  write_header ();
-+  if (output_files.is_empty ())
-+    output_files.safe_push (stdout);
-+
-+  for (auto f : output_files)
-+    write_header (f, header_name);
-+
-+  FILE *file = NULL;
-+  unsigned file_idx;
- 
-   /* Read the machine description.  */
- 
-@@ -5354,6 +5436,7 @@ main (int argc, const char **argv)
-   while (read_md_rtx (&info))
-     {
-       rtx def = info.def;
-+      file = choose_output (output_files, file_idx);
- 
-       acceptance_type acceptance;
-       acceptance.partial_p = false;
-@@ -5387,8 +5470,8 @@ main (int argc, const char **argv)
- 
- 	  /* Declare the gen_split routine that we'll call if the
- 	     pattern matches.  The definition comes from insn-emit.cc.  */
--	  printf ("extern rtx_insn *gen_split_%d (rtx_insn *, rtx *);\n",
--		  info.index);
-+	  fprintf (header, "extern rtx_insn *gen_split_%d "
-+		   "(rtx_insn *, rtx *);\n", info.index);
- 	  break;
- 
- 	case DEFINE_PEEPHOLE2:
-@@ -5399,8 +5482,8 @@ main (int argc, const char **argv)
- 
- 	  /* Declare the gen_peephole2 routine that we'll call if the
- 	     pattern matches.  The definition comes from insn-emit.cc.  */
--	  printf ("extern rtx_insn *gen_peephole2_%d (rtx_insn *, rtx *);\n",
--		  info.index);
-+	  fprintf (header, "extern rtx_insn *gen_peephole2_%d "
-+		   "(rtx_insn *, rtx *);\n", info.index);
- 	  break;
- 
- 	default:
-@@ -5411,7 +5494,8 @@ main (int argc, const char **argv)
-   if (have_error)
-     return FATAL_EXIT_CODE;
- 
--  puts ("\n\n");
-+  for (auto f : output_files)
-+    fprintf (f, "%s", "\n\n");
- 
-   /* Optimize each routine in turn.  */
-   optimize_subroutine_group ("recog", &insn_root);
-@@ -5433,15 +5517,27 @@ main (int argc, const char **argv)
-       /* Print out the routines that we just created.  */
-       unsigned int i;
-       pattern_routine *routine;
-+
-       FOR_EACH_VEC_ELT (patterns, i, routine)
--	print_pattern (&os, routine);
-+	print_pattern (header, &os, routine, true);
-+
-+      FOR_EACH_VEC_ELT (patterns, i, routine)
-+	{
-+	  file = choose_output (output_files, file_idx);
-+	  print_pattern (file, &os, routine);
-+	}
-     }
- 
-   /* Print out the matching routines.  */
--  print_subroutine_group (&os, RECOG, &insn_root);
--  print_subroutine_group (&os, SPLIT, &split_root);
--  print_subroutine_group (&os, PEEPHOLE2, &peephole2_root);
-+  print_subroutine_group (output_files, header, &os, RECOG, &insn_root);
-+  print_subroutine_group (output_files, header, &os, SPLIT, &split_root);
-+  print_subroutine_group (output_files, header, &os, PEEPHOLE2, &peephole2_root);
-+
-+  fclose (header);
- 
--  fflush (stdout);
--  return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
-+  int ret = SUCCESS_EXIT_CODE;
-+  for (FILE *f : output_files)
-+    if (fclose (f) != 0)
-+      ret = FATAL_EXIT_CODE;
-+  return ret;
- }
-diff --git a/gcc/gentarget-def.cc b/gcc/gentarget-def.cc
-index 061b1e7247c1..3a462560cc1b 100644
---- a/gcc/gentarget-def.cc
-+++ b/gcc/gentarget-def.cc
-@@ -191,7 +191,7 @@ def_target_insn (const char *name, const char *prototype)
- 	      printf ("target_have_%s (void)\n", name);
- 	      printf ("{\n");
- 	      printf ("  return ");
--	      rtx_reader_ptr->print_c_condition (test);
-+	      rtx_reader_ptr->print_c_condition (stdout, test);
- 	      printf (";\n");
- 	      printf ("}\n");
- 	    }
-diff --git a/gcc/read-md.cc b/gcc/read-md.cc
-index 93d1ea437812..aeb1cced00d0 100644
---- a/gcc/read-md.cc
-+++ b/gcc/read-md.cc
-@@ -192,9 +192,9 @@ md_reader::fprint_c_condition (FILE *outf, const char *cond)
- /* Special fprint_c_condition for writing to STDOUT.  */
- 
- void
--md_reader::print_c_condition (const char *cond)
-+md_reader::print_c_condition (FILE *outf, const char *cond)
- {
--  fprint_c_condition (stdout, cond);
-+  fprint_c_condition (outf, cond);
- }
- 
- /* A vfprintf-like function for reporting an error against line LINENO
-diff --git a/gcc/read-md.h b/gcc/read-md.h
-index e613c42b7241..b42add391ed8 100644
---- a/gcc/read-md.h
-+++ b/gcc/read-md.h
-@@ -205,7 +205,7 @@ class md_reader
- 
-   const char *join_c_conditions (const char *cond1, const char *cond2);
-   void fprint_c_condition (FILE *outf, const char *cond);
--  void print_c_condition (const char *cond);
-+  void print_c_condition (FILE *outf, const char *cond);
- 
-   /* Defined in read-rtl.cc.  */
-   const char *apply_iterator_to_string (const char *string);
-
-base-commit: 6a5a1b8175e07ff578204476cd11115d8a071cbc
--- 
-2.47.1
-

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 8b73c10..b66566b 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,5 +1,6 @@
 32	????
 
+	- 72_all_PR111600-genrecog-Split-into-separate-partitions.patch
 	- 74_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array.patch
 	- 75_all_PR117724-Fix-type-compatibility-for-types-with-flexible-array-2.patch
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-19 18:34 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-19 18:34 UTC (permalink / raw
  To: gentoo-commits

commit:     bf22395e91b68cb0cb464f72e08949ddd7ded9bf
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 19 18:34:00 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 19 18:34:00 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=bf22395e

15.0.0: drop 77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch

Committed upstream.

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

 ...7980-ICE-cxx_eval_outermost_constant_expr.patch | 130 ---------------------
 1 file changed, 130 deletions(-)

diff --git a/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch b/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
deleted file mode 100644
index f077536..0000000
--- a/15.0.0/gentoo/77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
+++ /dev/null
@@ -1,130 +0,0 @@
-https://inbox.sourceware.org/gcc-patches/20241212184222.471783-1-polacek@redhat.com/
-
-From f9ec39fcb8905fad2aba87bf328f0d5934b2385d Mon Sep 17 00:00:00 2001
-Message-ID: <f9ec39fcb8905fad2aba87bf328f0d5934b2385d.1734066473.git.sam@gentoo.org>
-From: Marek Polacek <polacek@redhat.com>
-Date: Thu, 12 Dec 2024 13:42:22 -0500
-Subject: [PATCH] c++: ICE in TARGET_EXPR evaluation in cp_fold_r [PR117980]
-
-This ICE started with the recent prvalue optimization (r15-6052).  In
-cp_fold_r we have:
-
-      if (tree &init = TARGET_EXPR_INITIAL (stmt))
-        {
-          cp_walk_tree (&init, cp_fold_r, data, NULL);
-          // ...
-	  tree folded = maybe_constant_init (init, TARGET_EXPR_SLOT (stmt));
-
-What can happen here is that originally the TARGET_EXPR is:
-
-    TARGET_EXPR <D.2747, <<< Unknown tree: aggr_init_expr
-      5
-      __ct_comp
-      D.2747
-      (struct subrange *) <<< Unknown tree: void_cst >>>
-      &TARGET_EXPR <D.2707, {.it=TARGET_EXPR <D.2695, ...>}> >>>>
-
-but after the first cp_walk_tree we fold the D.2707 TARGET_EXPR into:
-
-    TARGET_EXPR <D.2707, <<< Unknown tree: expr_stmt
-      D.2707.it = TARGET_EXPR <D.2695, ...> >>>>
-
-and then we pass the EXPR_STMT to maybe_constant_init, with D.2707 as
-the object.  But their types don't match anymore, so we crash.  We'd
-have to pass D.2707.it as the object for it to work.
-
-But I don't think we need to pass any object to maybe_constant_init;
-it'll grab the appropriate one itself.
-
-constexpr-prvalue3.C is reduced from a large std::ranges libstdc++ test.
-
-	PR c++/117980
-
-gcc/cp/ChangeLog:
-
-	* cp-gimplify.cc (cp_fold_r) <case TARGET_EXPR>: Don't pass an object
-	to maybe_constant_init.
-
-gcc/testsuite/ChangeLog:
-
-* g++.dg/cpp0x/constexpr-prvalue2.C: New test.
-	* g++.dg/cpp0x/constexpr-prvalue3.C: New test.
----
- gcc/cp/cp-gimplify.cc                         |  2 +-
- .../g++.dg/cpp0x/constexpr-prvalue2.C         | 15 +++++++++++
- .../g++.dg/cpp0x/constexpr-prvalue3.C         | 26 +++++++++++++++++++
- 3 files changed, 42 insertions(+), 1 deletion(-)
- create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue2.C
- create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue3.C
-
-diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
-index 623e2ee6e964..a861331c7c7d 100644
---- a/gcc/cp/cp-gimplify.cc
-+++ b/gcc/cp/cp-gimplify.cc
-@@ -1477,7 +1477,7 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_)
- 	  *walk_subtrees = 0;
- 	  if (!flag_no_inline)
- 	    {
--	      tree folded = maybe_constant_init (init, TARGET_EXPR_SLOT (stmt));
-+	      tree folded = maybe_constant_init (init);
- 	      if (folded != init && TREE_CONSTANT (folded))
- 		init = folded;
- 	    }
-diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue2.C
-new file mode 100644
-index 000000000000..46053231cf83
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue2.C
-@@ -0,0 +1,15 @@
-+// PR c++/117980
-+// { dg-do compile { target c++11 } }
-+// { dg-options "-O" }
-+
-+struct S {
-+  constexpr S(S &); // { dg-warning "used but never defined" }
-+  ~S();
-+};
-+struct B {
-+  S s;
-+};
-+struct A {
-+  B b;
-+};
-+void fn(B b) { A{b}; }
-diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue3.C
-new file mode 100644
-index 000000000000..a2eb12c02d74
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-prvalue3.C
-@@ -0,0 +1,26 @@
-+// PR c++/117980
-+// { dg-do compile { target c++11 } }
-+// { dg-options "-O" }
-+
-+struct _Safe_iterator  {
-+ _Safe_iterator();
-+  ~_Safe_iterator();
-+};
-+template <typename _Tp>
-+struct vector {
-+  vector(int) {}
-+  constexpr _Safe_iterator end() {
-+    return _Safe_iterator();
-+  }
-+};
-+template <typename It> struct sentinel {
-+  It it;
-+};
-+template <typename _Sent>
-+struct subrange {
-+  subrange(sentinel<_Safe_iterator>) {}
-+};
-+void test01() {
-+  vector<int> v{0};
-+  subrange<sentinel<_Safe_iterator>>{sentinel<_Safe_iterator>{v.end()}};
-+}
-
-base-commit: d136fa00f0d5faff8397edcd7e4ebb3445ab21b0
--- 
-2.47.1
-


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-20  1:55 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-20  1:55 UTC (permalink / raw
  To: gentoo-commits

commit:     f98ac56e7c38e054392b38f427cbfb04acf07c8f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 20 01:55:05 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 20 01:55:39 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f98ac56e

15.0.0: add diagnostics patch for C23

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

 ...ovements-to-too-few-many-arguments-errors.patch | 630 +++++++++++++++++++++
 15.0.0/gentoo/README.history                       |   5 +
 2 files changed, 635 insertions(+)

diff --git a/15.0.0/gentoo/77_all_PR118112-c-c-UX-improvements-to-too-few-many-arguments-errors.patch b/15.0.0/gentoo/77_all_PR118112-c-c-UX-improvements-to-too-few-many-arguments-errors.patch
new file mode 100644
index 0000000..8688ac1
--- /dev/null
+++ b/15.0.0/gentoo/77_all_PR118112-c-c-UX-improvements-to-too-few-many-arguments-errors.patch
@@ -0,0 +1,630 @@
+https://inbox.sourceware.org/gcc-patches/20241219234019.722392-1-dmalcolm@redhat.com/
+
+From b0525913499d305c2116e31bc6505ed67e87cf19 Mon Sep 17 00:00:00 2001
+Message-ID: <b0525913499d305c2116e31bc6505ed67e87cf19.1734659653.git.sam@gentoo.org>
+From: David Malcolm <dmalcolm@redhat.com>
+Date: Thu, 19 Dec 2024 18:40:19 -0500
+Subject: [PATCH] c/c++: UX improvements to 'too {few,many} arguments' errors
+ [PR118112]
+
+Consider this case of a bad call to a callback function (perhaps
+due to C23 changing the meaning of () in function decls):
+
+struct p {
+        int (*bar)();
+};
+
+void baz() {
+    struct p q;
+    q.bar(1);
+}
+
+Before this patch the C frontend emits:
+
+t.c: In function 'baz':
+t.c:7:5: error: too many arguments to function 'q.bar'
+    7 |     q.bar(1);
+      |     ^
+
+and the C++ frontend emits:
+
+t.c: In function 'void baz()':
+t.c:7:10: error: too many arguments to function
+    7 |     q.bar(1);
+      |     ~~~~~^~~
+
+neither of which give the user much help in terms of knowing what
+was expected, and where the relevant declaration is.
+
+With this patch the C frontend emits:
+
+t.c: In function 'baz':
+t.c:7:5: error: too many arguments to function 'q.bar'; expected 0, have 1
+    7 |     q.bar(1);
+      |     ^     ~
+t.c:2:15: note: declared here
+    2 |         int (*bar)();
+      |               ^~~
+
+(showing the expected vs actual counts, the pertinent field decl, and
+underlining the first extraneous argument at the callsite)
+
+and the C++ frontend emits:
+
+t.c: In function 'void baz()':
+t.c:7:10: error: too many arguments to function; expected 0, have 1
+    7 |     q.bar(1);
+      |     ~~~~~^~~
+
+(showing the expected vs actual counts; the other data was not accessible
+without a more invasive patch)
+
+Similarly, the patch also updates the "too few arguments" case to also
+show expected vs actual counts.  Doing so requires a tweak to the
+wording to say "at least" for the case of variadic fns, and for C++ fns
+with default args, where e.g. previously the C FE emitted:
+
+s.c: In function 'test':
+s.c:5:3: error: too few arguments to function 'callee'
+    5 |   callee ();
+      |   ^~~~~~
+s.c:1:6: note: declared here
+    1 | void callee (const char *, ...);
+      |      ^~~~~~
+
+with this patch it emits:
+
+s.c: In function 'test':
+s.c:5:3: error: too few arguments to function 'callee'; expected at least 1, have 0
+    5 |   callee ();
+      |   ^~~~~~
+s.c:1:6: note: declared here
+    1 | void callee (const char *, ...);
+      |      ^~~~~~
+
+Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
+OK for trunk?
+
+gcc/c/ChangeLog:
+	PR c/118112
+	* c-typeck.cc (inform_declaration): Add "function_expr" param and
+	use it for cases where we couldn't show the function decl to show
+	field decls for callbacks.
+	(build_function_call_vec): Add missing auto_diagnostic_group.
+	Update for new param of inform_declaration.
+	(convert_arguments): Likewise.  For the "too many arguments" case
+	add the expected vs actual counts to the message, and if we have
+	it, add the location_t of the first surplus param as a secondary
+	location within the diagnostic.  For the "too few arguments" case,
+	determine the minimum number of arguments required and add the
+	expected vs actual counts to the message, tweaking it to "at least"
+	for variadic functions.
+
+gcc/cp/ChangeLog:
+	PR c/118112
+	* typeck.cc (error_args_num): Add params "expected_num",
+	"actual_num", and "at_least_p".  Compute "too_many_p" from these
+	rather than have it be a param.  Add expected vs actual counts to
+	the messages and tweak them for the "at least" case.
+	(convert_arguments): Update calls to error_args_num to pass in
+	expected vs actual number, and the "at_least_p", determining this
+	for the "too few" case.
+
+gcc/testsuite/ChangeLog:
+	PR c/118112
+	* c-c++-common/too-few-arguments.c: New test.
+	* c-c++-common/too-many-arguments.c: New test.
+	* g++.dg/cpp0x/variadic169.C: Verify the reported expected vs
+	actual argument counts.
+	* g++.dg/modules/macloc-1_c.C: Update regexp for addition of param
+	counts to error message.
+	* g++.dg/modules/macloc-1_d.C: Likewise.
+
+Signed-off-by: David Malcolm <dmalcolm@redhat.com>
+---
+ gcc/c/c-typeck.cc                             | 77 ++++++++++++---
+ gcc/cp/typeck.cc                              | 94 ++++++++++++++----
+ .../c-c++-common/too-few-arguments.c          | 38 ++++++++
+ .../c-c++-common/too-many-arguments.c         | 96 +++++++++++++++++++
+ gcc/testsuite/g++.dg/cpp0x/variadic169.C      |  2 +-
+ gcc/testsuite/g++.dg/modules/macloc-1_c.C     |  4 +-
+ gcc/testsuite/g++.dg/modules/macloc-1_d.C     |  4 +-
+ 7 files changed, 280 insertions(+), 35 deletions(-)
+ create mode 100644 gcc/testsuite/c-c++-common/too-few-arguments.c
+ create mode 100644 gcc/testsuite/c-c++-common/too-many-arguments.c
+
+diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
+index 9756edaae084..fff2bba06954 100644
+--- a/gcc/c/c-typeck.cc
++++ b/gcc/c/c-typeck.cc
+@@ -3737,14 +3737,30 @@ build_function_call (location_t loc, tree function, tree params)
+   return ret;
+ }
+ 
+-/* Give a note about the location of the declaration of DECL.  */
++/* Give a note about the location of the declaration of DECL,
++   or, failing that, a pertinent declaration for FUNCTION_EXPR.  */
+ 
+ static void
+-inform_declaration (tree decl)
++inform_declaration (tree decl, tree function_expr)
+ {
+   if (decl && (TREE_CODE (decl) != FUNCTION_DECL
+ 	       || !DECL_IS_UNDECLARED_BUILTIN (decl)))
+     inform (DECL_SOURCE_LOCATION (decl), "declared here");
++  else if (function_expr)
++    switch (TREE_CODE (function_expr))
++      {
++      default:
++	break;
++      case COMPONENT_REF:
++	/* Show the decl of the pertinent field (e.g. for callback
++	   fields in a struct.  */
++	{
++	  tree field_decl = TREE_OPERAND (function_expr, 1);
++	  if (location_t loc = DECL_SOURCE_LOCATION (field_decl))
++	    inform (loc, "declared here");
++	}
++	break;
++      }
+ }
+ 
+ /* C implementation of callback for use when checking param types.  */
+@@ -3819,10 +3835,11 @@ build_function_call_vec (location_t loc, vec<location_t> arg_loc,
+ 		  function);
+       else if (DECL_P (function))
+ 	{
++	  auto_diagnostic_group d;
+ 	  error_at (loc,
+ 		    "called object %qD is not a function or function pointer",
+ 		    function);
+-	  inform_declaration (function);
++	  inform_declaration (function, NULL_TREE);
+ 	}
+       else
+ 	error_at (loc,
+@@ -4276,25 +4293,37 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree fntype,
+ 
+       if (type == void_type_node)
+ 	{
++	  auto_diagnostic_group d;
++	  int num_expected = parmnum;
++	  int num_actual = values->length ();
++	  gcc_rich_location rich_loc (loc);
++	  if (ploc != input_location)
++	    rich_loc.add_range (ploc);
+ 	  if (selector)
+-	    error_at (loc, "too many arguments to method %qE", selector);
++	    error_at (&rich_loc,
++		      "too many arguments to method %qE; expected %i, have %i",
++		      selector, num_expected, num_actual);
+ 	  else
+-	    error_at (loc, "too many arguments to function %qE", function);
+-	  inform_declaration (fundecl);
++	    error_at (&rich_loc,
++		      "too many arguments to function %qE; expected %i, have %i",
++		      function, num_expected, num_actual);
++	  inform_declaration (fundecl, function);
+ 	  return error_args ? -1 : (int) parmnum;
+ 	}
+ 
+       if (builtin_type == void_type_node)
+ 	{
++	  auto_diagnostic_group d;
+ 	  if (warning_at (loc, OPT_Wbuiltin_declaration_mismatch,
+ 			  "too many arguments to built-in function %qE "
+ 			  "expecting %d", function, parmnum))
+-	    inform_declaration (fundecl);
++	    inform_declaration (fundecl, function);
+ 	  builtin_typetail = NULL_TREE;
+ 	}
+ 
+       if (!typetail && parmnum == 0 && !TYPE_NO_NAMED_ARGS_STDARG_P (fntype))
+ 	{
++	  auto_diagnostic_group d;
+ 	  bool warned;
+ 	  if (selector)
+ 	    warned = warning_at (loc, OPT_Wdeprecated_non_prototype,
+@@ -4307,7 +4336,7 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree fntype,
+ 				 " for function %qE declared without parameters",
+ 				 function);
+ 	  if (warned)
+-	    inform_declaration (fundecl);
++	    inform_declaration (fundecl, function);
+ 	}
+ 
+       if (selector && argnum > 2)
+@@ -4437,8 +4466,33 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree fntype,
+ 
+   if (typetail != NULL_TREE && TREE_VALUE (typetail) != void_type_node)
+     {
+-      error_at (loc, "too few arguments to function %qE", function);
+-      inform_declaration (fundecl);
++      /* Not enough args.
++	 Determine minimum number of arguments required.  */
++      int min_expected_num = 0;
++      bool at_least_p = false;
++      tree iter = typelist;
++      while (true)
++	{
++	  if (!iter)
++	    {
++	      /* Variadic arguments; stop iterating.  */
++	      at_least_p = true;
++	      break;
++	    }
++	  if (iter == void_list_node)
++	    /* End of arguments; stop iterating.  */
++	    break;
++	  ++min_expected_num;
++	  iter = TREE_CHAIN (iter);
++	}
++      auto_diagnostic_group d;
++      int actual_num = vec_safe_length (values);
++      error_at (loc,
++		at_least_p
++		? G_("too few arguments to function %qE; expected at least %i, have %i")
++		: G_("too few arguments to function %qE; expected %i, have %i"),
++		function, min_expected_num, actual_num);
++      inform_declaration (fundecl, function);
+       return -1;
+     }
+ 
+@@ -4448,10 +4502,11 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree fntype,
+       for (tree t = builtin_typetail; t; t = TREE_CHAIN (t))
+ 	++nargs;
+ 
++      auto_diagnostic_group d;
+       if (warning_at (loc, OPT_Wbuiltin_declaration_mismatch,
+ 		      "too few arguments to built-in function %qE "
+ 		      "expecting %u", function, nargs - 1))
+-	inform_declaration (fundecl);
++	inform_declaration (fundecl, function);
+     }
+ 
+   return error_args ? -1 : (int) parmnum;
+diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
+index 964e549a6122..2966931ca8c1 100644
+--- a/gcc/cp/typeck.cc
++++ b/gcc/cp/typeck.cc
+@@ -59,7 +59,7 @@ static tree get_delta_difference (tree, tree, bool, bool, tsubst_flags_t);
+ static void casts_away_constness_r (tree *, tree *, tsubst_flags_t);
+ static bool casts_away_constness (tree, tree, tsubst_flags_t);
+ static bool maybe_warn_about_returning_address_of_local (tree, location_t = UNKNOWN_LOCATION);
+-static void error_args_num (location_t, tree, bool);
++static void error_args_num (location_t, tree, int, int, bool);
+ static int convert_arguments (tree, vec<tree, va_gc> **, tree, int,
+                               tsubst_flags_t);
+ static bool is_std_move_p (tree);
+@@ -4533,11 +4533,16 @@ cp_build_function_call_vec (tree function, vec<tree, va_gc> **params,
+ }
+ \f
+ /* Subroutine of convert_arguments.
+-   Print an error message about a wrong number of arguments.  */
++   Print an error message about a wrong number of arguments.
++   If AT_LEAST_P is true, then EXPECTED_NUM is the minimum number
++   of expected arguments.  */
+ 
+ static void
+-error_args_num (location_t loc, tree fndecl, bool too_many_p)
++error_args_num (location_t loc, tree fndecl, int expected_num, int actual_num,
++		bool at_least_p)
+ {
++  gcc_assert (expected_num != actual_num);
++  const bool too_many_p = actual_num > expected_num;
+   if (fndecl)
+     {
+       auto_diagnostic_group d;
+@@ -4548,22 +4553,28 @@ error_args_num (location_t loc, tree fndecl, bool too_many_p)
+ 		  == DECL_NAME (TYPE_NAME (DECL_CONTEXT (fndecl)))))
+ 	    error_at (loc,
+ 		      too_many_p
+-		      ? G_("too many arguments to constructor %q#D")
+-		      : G_("too few arguments to constructor %q#D"),
+-		      fndecl);
++		      ? G_("too many arguments to constructor %q#D; expected %i, have %i")
++		      : (at_least_p
++			 ? G_("too few arguments to constructor %q#D; expected at least %i, have %i")
++			 : G_("too few arguments to constructor %q#D; expected %i, have %i")),
++		      fndecl, expected_num, actual_num);
+ 	  else
+ 	    error_at (loc,
+ 		      too_many_p
+-		      ? G_("too many arguments to member function %q#D")
+-		      : G_("too few arguments to member function %q#D"),
+-		      fndecl);
++		      ? G_("too many arguments to member function %q#D; expected %i, have %i")
++		      : (at_least_p
++			 ? G_("too few arguments to member function %q#D; expected at least %i, have %i")
++			 : G_("too few arguments to member function %q#D; expected %i, have %i")),
++		      fndecl, expected_num, actual_num);
+ 	}
+       else
+ 	error_at (loc,
+ 		  too_many_p
+-		  ? G_("too many arguments to function %q#D")
+-		  : G_("too few arguments to function %q#D"),
+-		  fndecl);
++		  ? G_("too many arguments to function %q#D; expected %i, have %i")
++		  : (at_least_p
++		     ? G_("too few arguments to function %q#D; expected at least %i, have %i")
++		     : G_("too few arguments to function %q#D; expected %i, have %i")),
++		  fndecl, expected_num, actual_num);
+       if (!DECL_IS_UNDECLARED_BUILTIN (fndecl))
+ 	inform (DECL_SOURCE_LOCATION (fndecl), "declared here");
+     }
+@@ -4572,12 +4583,19 @@ error_args_num (location_t loc, tree fndecl, bool too_many_p)
+       if (c_dialect_objc ()  &&  objc_message_selector ())
+ 	error_at (loc,
+ 		  too_many_p
+-		  ? G_("too many arguments to method %q#D")
+-		  : G_("too few arguments to method %q#D"),
+-		  objc_message_selector ());
++		  ? G_("too many arguments to method %q#D; expected %i, have %i")
++		  : (at_least_p
++		     ? G_("too few arguments to method %q#D; expected at least %i, have %i")
++		     : G_("too few arguments to method %q#D; expected %i, have %i")),
++		  objc_message_selector (), expected_num, actual_num);
+       else
+-	error_at (loc, too_many_p ? G_("too many arguments to function")
+-		                  : G_("too few arguments to function"));
++	error_at (loc,
++		  too_many_p
++		  ? G_("too many arguments to function; expected %i, have %i")
++		  : (at_least_p
++		     ? G_("too few arguments to function; expected at least %i, have %i")
++		     : G_("too few arguments to function; expected %i, have %i")),
++		  expected_num, actual_num);
+     }
+ }
+ 
+@@ -4607,6 +4625,10 @@ convert_arguments (tree typelist, vec<tree, va_gc> **values, tree fndecl,
+   /* Argument passing is always copy-initialization.  */
+   flags |= LOOKUP_ONLYCONVERTING;
+ 
++  /* Preserve actual number of arguments passed (without counting default
++     args), in case we need to complain about too many/few.  */
++  int actual_num = vec_safe_length (*values);
++
+   for (i = 0, typetail = typelist;
+        i < vec_safe_length (*values);
+        i++)
+@@ -4621,7 +4643,10 @@ convert_arguments (tree typelist, vec<tree, va_gc> **values, tree fndecl,
+ 	{
+           if (complain & tf_error)
+             {
+-	      error_args_num (input_location, fndecl, /*too_many_p=*/true);
++	      /* Too many args.  */
++	      int expected_num = i;
++	      error_args_num (input_location, fndecl, expected_num, actual_num,
++			      false);
+               return i;
+             }
+           else
+@@ -4743,7 +4768,38 @@ convert_arguments (tree typelist, vec<tree, va_gc> **values, tree fndecl,
+       if (typetail && typetail != void_list_node)
+ 	{
+ 	  if (complain & tf_error)
+-	    error_args_num (input_location, fndecl, /*too_many_p=*/false);
++	    {
++	      /* Not enough args.
++		 Determine minimum number of arguments required.  */
++	      int min_expected_num = 0;
++	      bool at_least_p = false;
++	      tree iter = typelist;
++	      while (true)
++		{
++		  if (!iter)
++		    {
++		      /* Variadic arguments; stop iterating.  */
++		      at_least_p = true;
++		      break;
++		    }
++		  if (iter == void_list_node)
++		    /* End of arguments; stop iterating.  */
++		    break;
++		  if (fndecl && TREE_PURPOSE (iter)
++		      && TREE_CODE (TREE_PURPOSE (iter)) != DEFERRED_PARSE)
++		    {
++		      /* Found a default argument; skip this one when
++			 counting minimum required.  */
++		      at_least_p = true;
++		      iter = TREE_CHAIN (iter);
++		      continue;
++		    }
++		  ++min_expected_num;
++		  iter = TREE_CHAIN (iter);
++		}
++	      error_args_num (input_location, fndecl,
++			      min_expected_num, actual_num, at_least_p);
++	    }
+ 	  return -1;
+ 	}
+     }
+diff --git a/gcc/testsuite/c-c++-common/too-few-arguments.c b/gcc/testsuite/c-c++-common/too-few-arguments.c
+new file mode 100644
+index 000000000000..633dccfeaf24
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/too-few-arguments.c
+@@ -0,0 +1,38 @@
++extern void fn_a (void);
++extern void fn_b (int); /* { dg-message "declared here" } */
++extern void fn_c (int, int); /* { dg-message "declared here" } */
++#ifdef __cplusplus
++extern void fn_d (int, int=42); /* { dg-message "declared here" "" { target c++ } } */
++extern void fn_e (int, int=42, int=1066); /* { dg-message "declared here" "" { target c++ } } */
++#endif
++extern void fn_f (const char *, ...); /* { dg-message "declared here" } */
++
++void test_known_fn (void)
++{
++  fn_a ();
++  fn_b ();  /* { dg-error "too few arguments to function '\[^\n\r\]*'; expected 1, have 0" } */
++  fn_c (42);/* { dg-error "too few arguments to function '\[^\n\r\]*'; expected 2, have 1" } */
++#ifdef __cplusplus
++  fn_d ();  /* { dg-error "too few arguments to function '\[^\n\r\]*'; expected at least 1, have 0" "" { target c++ } } */
++  fn_e ();  /* { dg-error "too few arguments to function '\[^\n\r\]*'; expected at least 1, have 0" "" { target c++ } } */
++#endif
++  fn_f ();  /* { dg-error "too few arguments to function '\[^\n\r\]*'; expected at least 1, have 0" } */
++}
++
++struct foo
++{
++  void (*callback_a) (void);
++  void (*callback_b) (int); /* { dg-message "declared here" "" { target c } } */
++  void (*callback_c) (int, int); /* { dg-message "declared here" "" { target c } } */
++};
++
++void test_callback (struct foo *f)
++{
++  f->callback_a ();
++  
++  f->callback_b (); /* { dg-error "too few arguments to function 'f->callback_b'; expected 1, have 0" "" { target c } } */
++  /* { dg-error "too few arguments to function; expected 1, have 0" "" { target c++ } .-1 } */
++
++  f->callback_c (42); /* { dg-error "too few arguments to function 'f->callback_c'; expected 2, have 1" "" { target c } } */
++  /* { dg-error "too few arguments to function; expected 2, have 1" "" { target c++ } .-1 } */
++}
+diff --git a/gcc/testsuite/c-c++-common/too-many-arguments.c b/gcc/testsuite/c-c++-common/too-many-arguments.c
+new file mode 100644
+index 000000000000..7f9f8d4870bf
+--- /dev/null
++++ b/gcc/testsuite/c-c++-common/too-many-arguments.c
+@@ -0,0 +1,96 @@
++/* For C, verify that the first excess param is underlined.
++   For C++ the calls location covers all the params, so we
++   can't underline individual params.  */
++/* { dg-additional-options "-fdiagnostics-show-caret" { target c } } */
++
++extern void fn_a (); /* { dg-message "declared here" } */
++extern void fn_b (void); /* { dg-message "declared here" } */
++extern void fn_c (int); /* { dg-message "declared here" } */
++#ifdef __cplusplus
++extern void fn_d (int, int=42); /* { dg-message "declared here" "" { target c++ } } */
++#endif
++
++void test_known_fn (void)
++{
++  fn_a (42); /* { dg-error "too many arguments to function 'fn_a'; expected 0, have 1" "" { target c } } */
++  /* { dg-error "too many arguments to function 'void fn_a\\(\\)'; expected 0, have 1" "" { target c++ } .-1 } */
++  /* { dg-begin-multiline-output "" }
++   fn_a (42);
++   ^~~~  ~~
++     { dg-end-multiline-output "" { target c } } */
++  /* { dg-begin-multiline-output "" }
++ extern void fn_a ();
++             ^~~~
++     { dg-end-multiline-output "" { target c } } */
++
++  fn_b (1776); /* { dg-error "too many arguments to function 'fn_b'; expected 0, have 1" "" { target c } } */
++  /* { dg-error "too many arguments to function 'void fn_b\\(\\)'; expected 0, have 1" "" { target c++ } .-1 } */
++  /* { dg-begin-multiline-output "" }
++   fn_b (1776);
++   ^~~~  ~~~~
++   { dg-end-multiline-output "" { target c } } */
++  /* { dg-begin-multiline-output "" }
++ extern void fn_b (void);
++             ^~~~
++     { dg-end-multiline-output "" { target c } } */
++
++  fn_c (1066, 1649);  /* { dg-error "too many arguments to function 'fn_c'; expected 1, have 2" "" { target c } } */
++  /* { dg-error "too many arguments to function 'void fn_c\\(int\\)'; expected 1, have 2" "" { target c++ } .-1 } */
++  /* { dg-begin-multiline-output "" }
++   fn_c (1066, 1649);
++   ^~~~        ~~~~
++   { dg-end-multiline-output "" { target c } } */
++  /* { dg-begin-multiline-output "" }
++ extern void fn_c (int);
++             ^~~~
++     { dg-end-multiline-output "" { target c } } */
++
++#ifdef __cplusplus
++  fn_d (1066);
++  fn_d (1066, 1649);
++  fn_d (1066, 1649, 1776); /* { dg-error "too many arguments to function '\[^\n\r\]*'; expected 2, have 3" "" { target c++ } } */
++#endif
++}
++
++struct foo
++{
++  void (*callback_a)(); /* { dg-message "declared here" "" { target c } } */
++  void (*callback_b)(void); /* { dg-message "declared here" "" { target c } } */
++  void (*callback_c)(int); /* { dg-message "declared here" "" { target c } } */
++};
++
++void test_callback (struct foo *f)
++{
++  f->callback_a (42); /* { dg-error "too many arguments to function 'f->callback_a'; expected 0, have 1" "" { target c } } */
++  /* { dg-error "too many arguments to function; expected 0, have 1" "" { target c++ } .-1 } */
++  /* { dg-begin-multiline-output "" }
++   f->callback_a (42);
++   ^              ~~
++     { dg-end-multiline-output "" { target c } } */
++  /* { dg-begin-multiline-output "" }
++   void (*callback_a)();
++          ^~~~~~~~~~
++     { dg-end-multiline-output "" { target c } } */
++  
++  f->callback_b (1776); /* { dg-error "too many arguments to function 'f->callback_b'; expected 0, have 1" "" { target c } } */
++  /* { dg-error "too many arguments to function; expected 0, have 1" "" { target c++ } .-1 } */
++  /* { dg-begin-multiline-output "" }
++   f->callback_b (1776);
++   ^              ~~~~
++     { dg-end-multiline-output "" { target c } } */
++  /* { dg-begin-multiline-output "" }
++   void (*callback_b)(void);
++          ^~~~~~~~~~
++     { dg-end-multiline-output "" { target c } } */
++
++  f->callback_c (1066, 1649); /* { dg-error "too many arguments to function 'f->callback_c'; expected 1, have 2" "" { target c } } */
++  /* { dg-error "too many arguments to function; expected 1, have 2" "" { target c++ } .-1 } */
++  /* { dg-begin-multiline-output "" }
++   f->callback_c (1066, 1649);
++   ^                    ~~~~
++     { dg-end-multiline-output "" { target c } } */
++  /* { dg-begin-multiline-output "" }
++   void (*callback_c)(int);
++          ^~~~~~~~~~
++     { dg-end-multiline-output "" { target c } } */
++}
+diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic169.C b/gcc/testsuite/g++.dg/cpp0x/variadic169.C
+index 6858973cd2eb..460bb3b8a193 100644
+--- a/gcc/testsuite/g++.dg/cpp0x/variadic169.C
++++ b/gcc/testsuite/g++.dg/cpp0x/variadic169.C
+@@ -5,5 +5,5 @@ template<typename ...T> void f(int n = 0, T ...t);
+ 
+ int main()
+ {
+-  f<int>();			// { dg-error "too few arguments" }
++  f<int>();			// { dg-error "too few arguments to function '\[^\n\r\]*'; expected at least 1, have 0" }
+ }
+diff --git a/gcc/testsuite/g++.dg/modules/macloc-1_c.C b/gcc/testsuite/g++.dg/modules/macloc-1_c.C
+index 5865a34687e7..3f980c213814 100644
+--- a/gcc/testsuite/g++.dg/modules/macloc-1_c.C
++++ b/gcc/testsuite/g++.dg/modules/macloc-1_c.C
+@@ -8,6 +8,6 @@ void gru ()
+   you (1);
+ }
+ 
+-// { dg-regexp "\[^\n]*macloc-1_c.C:7:6: error: too many arguments to function 'int me@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" }
++// { dg-regexp "\[^\n]*macloc-1_c.C:7:6: error: too many arguments to function 'int me@agnes\\(\\)'; expected 0, have 1\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" }
+ 
+-// { dg-regexp "\[^\n]*macloc-1_c.C:8:7: error: too many arguments to function 'int you@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:12:14: note: declared here\n\[^\n]*macloc-1_a.C:9:22: note: in definition of macro 'KEVIN'\n" }
++// { dg-regexp "\[^\n]*macloc-1_c.C:8:7: error: too many arguments to function 'int you@agnes\\(\\)'; expected 0, have 1\nIn module agnes, imported at \[^\n]*macloc-1_b.C:8,\nof module edith, imported at \[^\n]*macloc-1_c.C:3:\n\[^\n]*macloc-1_a.C:12:14: note: declared here\n\[^\n]*macloc-1_a.C:9:22: note: in definition of macro 'KEVIN'\n" }
+diff --git a/gcc/testsuite/g++.dg/modules/macloc-1_d.C b/gcc/testsuite/g++.dg/modules/macloc-1_d.C
+index 282a31c4a2d1..56c001fc3f83 100644
+--- a/gcc/testsuite/g++.dg/modules/macloc-1_d.C
++++ b/gcc/testsuite/g++.dg/modules/macloc-1_d.C
+@@ -9,5 +9,5 @@ void margo ()
+   gru (2);
+ }
+ 
+-// { dg-regexp "\[^\n]*macloc-1_d.C:8:6: error: too many arguments to function 'int me@agnes\\(\\)'\nIn module agnes, imported at \[^\n]*macloc-1_d.C:4:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" }
+-// { dg-regexp "\[^\n]*macloc-1_d.C:9:7: error: too many arguments to function 'void gru@edith\\(\\)'\nIn module edith, imported at \[^\n]*macloc-1_d.C:3:\n\[^\n]*macloc-1_b.C:10:20: note: declared here\n\[^\n]*macloc-1_b.C:6:19: note: in definition of macro 'STUART'\n" }
++// { dg-regexp "\[^\n]*macloc-1_d.C:8:6: error: too many arguments to function 'int me@agnes\\(\\)'; expected 0, have 1\nIn module agnes, imported at \[^\n]*macloc-1_d.C:4:\n\[^\n]*macloc-1_a.C:11:12: note: declared here\n\[^\n]*macloc-1_a.C:8:20: note: in definition of macro 'BOB'\n" }
++// { dg-regexp "\[^\n]*macloc-1_d.C:9:7: error: too many arguments to function 'void gru@edith\\(\\)'; expected 0, have 1\nIn module edith, imported at \[^\n]*macloc-1_d.C:3:\n\[^\n]*macloc-1_b.C:10:20: note: declared here\n\[^\n]*macloc-1_b.C:6:19: note: in definition of macro 'STUART'\n" }
+
+base-commit: b11e85adbfdb02bc7743098d358a5ea362648ca1
+-- 
+2.47.1
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index e2217e1..515a20d 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,8 @@
+33	????
+
+	- 77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
+	+ 77_all_PR118112-c-c-UX-improvements-to-too-few-many-arguments-errors.patch
+
 32	16 December 2024
 
 	- 72_all_PR111600-genrecog-Split-into-separate-partitions.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-20  5:57 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-20  5:57 UTC (permalink / raw
  To: gentoo-commits

commit:     8c4b3ec7d2a3a535646648d05bcaa6706cc0f695
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 20 05:57:00 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 20 05:57:00 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8c4b3ec7

15.0.0: revert patch causing (riscv) bootstrap slowdown

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

 ...le-Add-limit-after-which-slower-switchlow.patch | 238 +++++++++++++++++++++
 15.0.0/gentoo/README.history                       |   1 +
 2 files changed, 239 insertions(+)

diff --git a/15.0.0/gentoo/78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch b/15.0.0/gentoo/78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch
new file mode 100644
index 0000000..d7f2c46
--- /dev/null
+++ b/15.0.0/gentoo/78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch
@@ -0,0 +1,238 @@
+From 7305d9452ae9bfc3ee299a194b103e4a4786b0ee Mon Sep 17 00:00:00 2001
+Message-ID: <7305d9452ae9bfc3ee299a194b103e4a4786b0ee.1734674183.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Fri, 20 Dec 2024 05:56:03 +0000
+Subject: [PATCH] Revert "gimple: Add limit after which slower switchlower algs
+ are used [PR117091] [PR117352]"
+
+This reverts commit 56946c801a7cf3a831a11870b7e11ba08bf9bd87.
+
+Bug: https://gcc.gnu.org/PR118032
+---
+ gcc/doc/invoke.texi           |   3 -
+ gcc/params.opt                |   4 --
+ gcc/tree-switch-conversion.cc | 112 +++-------------------------------
+ gcc/tree-switch-conversion.h  |  18 ------
+ 4 files changed, 7 insertions(+), 130 deletions(-)
+
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index 8ed5536365f7..08ad6b998b79 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -16522,9 +16522,6 @@ Switch initialization conversion refuses to create arrays that are
+ bigger than @option{switch-conversion-max-branch-ratio} times the number of
+ branches in the switch.
+ 
+-@item switch-lower-slow-alg-max-cases
+-Maximum number of cases for slow switch lowering algorithms to be used.
+-
+ @item max-partial-antic-length
+ Maximum length of the partial antic set computed during the tree
+ partial redundancy elimination optimization (@option{-ftree-pre}) when
+diff --git a/gcc/params.opt b/gcc/params.opt
+index 1c88d5212c40..5853bf02f9ee 100644
+--- a/gcc/params.opt
++++ b/gcc/params.opt
+@@ -1052,10 +1052,6 @@ Maximum number of instruction distance that a small store forwarded to a larger
+ Common Joined UInteger Var(param_switch_conversion_branch_ratio) Init(8) IntegerRange(1, 65536) Param Optimization
+ The maximum ratio between array size and switch branches for a switch conversion to take place.
+ 
+--param=switch-lower-slow-alg-max-cases=
+-Common Joined UInteger Var(param_switch_lower_slow_alg_max_cases) Init(1000) IntegerRange(1, 1000000000) Param Optimization
+-Maximum number of cases for slow switch lowering algorithms to be used.
+-
+ -param=modref-max-bases=
+ Common Joined UInteger Var(param_modref_max_bases) Init(32) Param Optimization
+ Maximum number of bases stored in each modref tree.
+diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
+index b98e70cf7d16..3436c2a8b98c 100644
+--- a/gcc/tree-switch-conversion.cc
++++ b/gcc/tree-switch-conversion.cc
+@@ -54,7 +54,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+ #include "tree-cfgcleanup.h"
+ #include "hwint.h"
+ #include "internal-fn.h"
+-#include "diagnostic-core.h"
+ 
+ /* ??? For lang_hooks.types.type_for_mode, but is there a word_mode
+    type in the GIMPLE type system that is language-independent?  */
+@@ -1642,11 +1641,6 @@ jump_table_cluster::find_jump_tables (vec<cluster *> &clusters)
+     return clusters.copy ();
+ 
+   unsigned l = clusters.length ();
+-
+-  /* Note: l + 1 is the number of cases of the switch.  */
+-  if (l + 1 > (unsigned) param_switch_lower_slow_alg_max_cases)
+-    return clusters.copy ();
+-
+   auto_vec<min_cluster_item> min;
+   min.reserve (l + 1);
+ 
+@@ -1777,80 +1771,16 @@ jump_table_cluster::is_beneficial (const vec<cluster *> &,
+   return end - start + 1 >= case_values_threshold ();
+ }
+ 
+-/* Find bit tests of given CLUSTERS, where all members of the vector are of
+-   type simple_cluster.  Use a fast algorithm that might not find the optimal
+-   solution (minimal number of clusters on the output).  New clusters are
+-   returned.
+-
+-   You should call find_bit_tests () instead of calling this function
+-   directly.  */
+-
+-vec<cluster *>
+-bit_test_cluster::find_bit_tests_fast (vec<cluster *> &clusters)
+-{
+-  unsigned l = clusters.length ();
+-  vec<cluster *> output;
+-
+-  output.create (l);
+-
+-  /* Look at sliding BITS_PER_WORD sized windows in the switch value space
+-     and determine if they are suitable for a bit test cluster.  Worst case
+-     this can examine every value BITS_PER_WORD-1 times.  */
+-  unsigned k;
+-  for (unsigned i = 0; i < l; i += k)
+-    {
+-      hash_set<basic_block> targets;
+-      cluster *start_cluster = clusters[i];
+-
+-      /* Find the biggest k such that clusters i to i+k-1 can be turned into a
+-	 one big bit test cluster.  */
+-      k = 0;
+-      while (i + k < l)
+-	{
+-	  cluster *end_cluster = clusters[i + k];
+-
+-	  /* Does value range fit into the BITS_PER_WORD window?  */
+-	  HOST_WIDE_INT w = cluster::get_range (start_cluster->get_low (),
+-						end_cluster->get_high ());
+-	  if (w == 0 || w > BITS_PER_WORD)
+-	    break;
+-
+-	  /* Check for max # of targets.  */
+-	  if (targets.elements () == m_max_case_bit_tests
+-	      && !targets.contains (end_cluster->m_case_bb))
+-	    break;
+-
+-	  targets.add (end_cluster->m_case_bb);
+-	  k++;
+-	}
+-
+-      if (is_beneficial (k, targets.elements ()))
+-	{
+-	  output.safe_push (new bit_test_cluster (clusters, i, i + k - 1,
+-						  i == 0 && k == l));
+-	}
+-      else
+-	{
+-	  output.safe_push (clusters[i]);
+-	  /* ??? Might be able to skip more.  */
+-	  k = 1;
+-	}
+-    }
+-
+-  return output;
+-}
+-
+ /* Find bit tests of given CLUSTERS, where all members of the vector
+-   are of type simple_cluster.  Use a slow (quadratic) algorithm that always
+-   finds the optimal solution (minimal number of clusters on the output).  New
+-   clusters are returned.
+-
+-   You should call find_bit_tests () instead of calling this function
+-   directly.  */
++   are of type simple_cluster.   MAX_C is the approx max number of cases per
++   label.  New clusters are returned.  */
+ 
+ vec<cluster *>
+-bit_test_cluster::find_bit_tests_slow (vec<cluster *> &clusters)
++bit_test_cluster::find_bit_tests (vec<cluster *> &clusters, int max_c)
+ {
++  if (!is_enabled () || max_c == 1)
++    return clusters.copy ();
++
+   unsigned l = clusters.length ();
+   auto_vec<min_cluster_item> min;
+   min.reserve (l + 1);
+@@ -1904,25 +1834,6 @@ bit_test_cluster::find_bit_tests_slow (vec<cluster *> &clusters)
+   return output;
+ }
+ 
+-/* Find bit tests of given CLUSTERS, where all members of the vector
+-   are of type simple_cluster.  MAX_C is the approx max number of cases per
+-   label.  New clusters are returned.  */
+-
+-vec<cluster *>
+-bit_test_cluster::find_bit_tests (vec<cluster *> &clusters, int max_c)
+-{
+-  if (!is_enabled () || max_c == 1)
+-    return clusters.copy ();
+-
+-  unsigned l = clusters.length ();
+-
+-  /* Note: l + 1 is the number of cases of the switch.  */
+-  if (l + 1 > (unsigned) param_switch_lower_slow_alg_max_cases)
+-    return find_bit_tests_fast (clusters);
+-  else
+-    return find_bit_tests_slow (clusters);
+-}
+-
+ /* Return true when RANGE of case values with UNIQ labels
+    can build a bit test.  */
+ 
+@@ -2353,19 +2264,10 @@ switch_decision_tree::analyze_switch_statement ()
+ 
+   reset_out_edges_aux (m_switch);
+ 
+-  if (l > (unsigned) param_switch_lower_slow_alg_max_cases)
+-    warning_at (gimple_location (m_switch), OPT_Wdisabled_optimization,
+-	       "Using faster switch lowering algorithms. "
+-	       "Number of switch cases (%d) exceeds "
+-	       "%<--param=switch-lower-slow-alg-max-cases=%d%> limit.",
+-	       l, param_switch_lower_slow_alg_max_cases);
+-
+   /* Find bit-test clusters.  */
+   vec<cluster *> output = bit_test_cluster::find_bit_tests (clusters, max_c);
+ 
+-  /* Find jump table clusters.  We are looking for these in the sequences of
+-     simple clusters which we didn't manage to convert into bit-test
+-     clusters.  */
++  /* Find jump table clusters.  */
+   vec<cluster *> output2;
+   auto_vec<cluster *> tmp;
+   output2.create (1);
+diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h
+index 560620903a86..e6a85fa60258 100644
+--- a/gcc/tree-switch-conversion.h
++++ b/gcc/tree-switch-conversion.h
+@@ -397,24 +397,6 @@ public:
+ 	     tree default_label_expr, basic_block default_bb, location_t loc)
+      final override;
+ 
+-  /* Find bit tests of given CLUSTERS, where all members of the vector are of
+-     type simple_cluster.  Use a fast algorithm that might not find the optimal
+-     solution (minimal number of clusters on the output).  New clusters are
+-     returned.
+-
+-     You should call find_bit_tests () instead of calling this function
+-     directly.  */
+-  static vec<cluster *> find_bit_tests_fast (vec<cluster *> &clusters);
+-
+-  /* Find bit tests of given CLUSTERS, where all members of the vector
+-     are of type simple_cluster.  Use a slow (quadratic) algorithm that always
+-     finds the optimal solution (minimal number of clusters on the output).  New
+-     clusters are returned.
+-
+-     You should call find_bit_tests () instead of calling this function
+-     directly.  */
+-  static vec<cluster *> find_bit_tests_slow (vec<cluster *> &clusters);
+-
+   /* Find bit tests of given CLUSTERS, where all members of the vector
+      are of type simple_cluster.  New clusters are returned.  */
+   static vec<cluster *> find_bit_tests (vec<cluster *> &clusters, int max_c);
+
+base-commit: b11e85adbfdb02bc7743098d358a5ea362648ca1
+-- 
+2.47.1
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 515a20d..dcaecc1 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -2,6 +2,7 @@
 
 	- 77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
 	+ 77_all_PR118112-c-c-UX-improvements-to-too-few-many-arguments-errors.patch
+	+ 78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch
 
 32	16 December 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-20 11:25 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-20 11:25 UTC (permalink / raw
  To: gentoo-commits

commit:     01d33f6be28d09edb2e9aaa66feab7a1b359aa60
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 20 11:24:56 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 20 11:25:19 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=01d33f6b

15.0.0: fix C++ init ICE

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

 ...Es-with-large-initializer-lists-or-ones-i.patch | 307 +++++++++++++++++++++
 15.0.0/gentoo/README.history                       |   1 +
 2 files changed, 308 insertions(+)

diff --git a/15.0.0/gentoo/79_all_PR118124-c-Fix-ICEs-with-large-initializer-lists-or-ones-i.patch b/15.0.0/gentoo/79_all_PR118124-c-Fix-ICEs-with-large-initializer-lists-or-ones-i.patch
new file mode 100644
index 0000000..ded69c7
--- /dev/null
+++ b/15.0.0/gentoo/79_all_PR118124-c-Fix-ICEs-with-large-initializer-lists-or-ones-i.patch
@@ -0,0 +1,307 @@
+https://inbox.sourceware.org/gcc-patches/Z2U3spZjDr+xEZP0@tucnak/
+
+From b904875837cae597709d37ec45f70c70d353e901 Mon Sep 17 00:00:00 2001
+Message-ID: <b904875837cae597709d37ec45f70c70d353e901.1734693860.git.sam@gentoo.org>
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Fri, 20 Dec 2024 10:24:02 +0100
+Subject: [PATCH] c++, v3: Fix ICEs with large initializer lists or ones
+ including #embed [PR118124]
+
+On Thu, Dec 19, 2024 at 07:01:39PM +0100, Jakub Jelinek wrote:
+> So far lightly tested, ok for trunk this way if it passes bootstrap & testing?
+
+Bootstrap/regtest found an issue, warning about
+  if ()
+    for ()
+      if ()
+      else if ()
+      else
+so I've added {}s around it (no other changes from the previous patch).
+
+Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
+
+2024-12-20  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c++/118124
+	* call.cc (convert_like_internal): Handle RAW_DATA_CST in
+	ck_list handling.  Formatting fixes.
+
+	* g++.dg/cpp/embed-15.C: New test.
+	* g++.dg/cpp/embed-16.C: New test.
+	* g++.dg/cpp0x/initlist-opt3.C: New test.
+	* g++.dg/cpp0x/initlist-opt4.C: New test.
+---
+ gcc/cp/call.cc                             | 84 ++++++++++++++++++++--
+ gcc/testsuite/g++.dg/cpp/embed-15.C        | 35 +++++++++
+ gcc/testsuite/g++.dg/cpp/embed-16.C        | 18 +++++
+ gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C | 47 ++++++++++++
+ gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C | 20 ++++++
+ 5 files changed, 198 insertions(+), 6 deletions(-)
+ create mode 100644 gcc/testsuite/g++.dg/cpp/embed-15.C
+ create mode 100644 gcc/testsuite/g++.dg/cpp/embed-16.C
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C
+
+diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
+index c8420db568ea..27cea0db80af 100644
+--- a/gcc/cp/call.cc
++++ b/gcc/cp/call.cc
+@@ -8766,8 +8766,8 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
+ 
+ 	if (tree init = maybe_init_list_as_array (elttype, expr))
+ 	  {
+-	    elttype = cp_build_qualified_type
+-	      (elttype, cp_type_quals (elttype) | TYPE_QUAL_CONST);
++	    elttype = cp_build_qualified_type (elttype, cp_type_quals (elttype)
++							| TYPE_QUAL_CONST);
+ 	    array = build_array_of_n_type (elttype, len);
+ 	    array = build_vec_init_expr (array, init, complain);
+ 	    array = get_target_expr (array);
+@@ -8775,13 +8775,85 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
+ 	  }
+ 	else if (len)
+ 	  {
+-	    tree val; unsigned ix;
+-
++	    tree val;
++	    unsigned ix;
+ 	    tree new_ctor = build_constructor (init_list_type_node, NULL);
+ 
+ 	    /* Convert all the elements.  */
+ 	    FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (expr), ix, val)
+ 	      {
++		if (TREE_CODE (val) == RAW_DATA_CST)
++		  {
++		    tree elt_type;
++		    conversion *next;
++		    /* For conversion to initializer_list<unsigned char> or
++		       initializer_list<char> or initializer_list<signed char>
++		       we can optimize and keep RAW_DATA_CST with adjusted
++		       type if we report narrowing errors if needed, for
++		       others this converts each element separately.  */
++		    if (convs->u.list[ix]->kind == ck_std
++			&& (elt_type = convs->u.list[ix]->type)
++			&& (TREE_CODE (elt_type) == INTEGER_TYPE
++			    || is_byte_access_type (elt_type))
++			&& TYPE_PRECISION (elt_type) == CHAR_BIT
++			&& (next = next_conversion (convs->u.list[ix]))
++			&& next->kind == ck_identity)
++		      {
++			if (!TYPE_UNSIGNED (elt_type)
++			    && (TYPE_UNSIGNED (TREE_TYPE (val))
++				|| (TYPE_PRECISION (TREE_TYPE (val))
++				    > CHAR_BIT)))
++			  for (int i = 0; i < RAW_DATA_LENGTH (val); ++i)
++			    {
++			      if (RAW_DATA_SCHAR_ELT (val, i) >= 0)
++				continue;
++			      else if (complain & tf_error)
++				{
++				  location_t loc
++				    = cp_expr_loc_or_input_loc (val);
++				  int savederrorcount = errorcount;
++				  permerror_opt (loc, OPT_Wnarrowing,
++						 "narrowing conversion of "
++						 "%qd from %qH to %qI",
++						 RAW_DATA_UCHAR_ELT (val, i),
++						 TREE_TYPE (val), elt_type);
++				  if (errorcount != savederrorcount)
++				    return error_mark_node;
++				}
++			      else
++				return error_mark_node;
++			    }
++			tree sub = copy_node (val);
++			TREE_TYPE (sub) = elt_type;
++			CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_ctor),
++						NULL_TREE, sub);
++		      }
++		    else
++		      {
++			for (int i = 0; i < RAW_DATA_LENGTH (val); ++i)
++			  {
++			    tree elt
++			      = build_int_cst (TREE_TYPE (val),
++					       RAW_DATA_UCHAR_ELT (val, i));
++			    tree sub
++			      = convert_like (convs->u.list[ix], elt,
++					      fn, argnum, false, false,
++					      /*nested_p=*/true, complain);
++			    if (sub == error_mark_node)
++			      return sub;
++			    if (!check_narrowing (TREE_TYPE (sub), elt,
++						  complain))
++			      return error_mark_node;
++			    tree nc = new_ctor;
++			    CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (nc),
++						    NULL_TREE, sub);
++			    if (!TREE_CONSTANT (sub))
++			      TREE_CONSTANT (new_ctor) = false;
++			  }
++		      }
++		    len += RAW_DATA_LENGTH (val) - 1;
++		    continue;
++		  }
+ 		tree sub = convert_like (convs->u.list[ix], val, fn,
+ 					 argnum, false, false,
+ 					 /*nested_p=*/true, complain);
+@@ -8796,8 +8868,8 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
+ 		  TREE_CONSTANT (new_ctor) = false;
+ 	      }
+ 	    /* Build up the array.  */
+-	    elttype = cp_build_qualified_type
+-	      (elttype, cp_type_quals (elttype) | TYPE_QUAL_CONST);
++	    elttype = cp_build_qualified_type (elttype, cp_type_quals (elttype)
++							| TYPE_QUAL_CONST);
+ 	    array = build_array_of_n_type (elttype, len);
+ 	    array = finish_compound_literal (array, new_ctor, complain);
+ 	    /* This is dubious now, should be blessed by P2752.  */
+diff --git a/gcc/testsuite/g++.dg/cpp/embed-15.C b/gcc/testsuite/g++.dg/cpp/embed-15.C
+new file mode 100644
+index 000000000000..a3994536e576
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp/embed-15.C
+@@ -0,0 +1,35 @@
++// PR c++/118124
++// { dg-do compile { target c++11 } }
++// { dg-options "-O2" }
++
++namespace std {
++template <class T> struct initializer_list {
++private:
++  const T *_M_array;
++  __SIZE_TYPE__ _M_len;
++};
++}
++struct A {
++  A (std::initializer_list<char>);
++};
++A a {
++#embed __FILE__
++};
++struct B {
++  B (std::initializer_list<unsigned char>);
++};
++B b {
++#embed __FILE__
++};
++struct C {
++  C (std::initializer_list<int>);
++};
++C c {
++#embed __FILE__
++};
++struct D {
++  D (std::initializer_list<float>);
++};
++D d {
++#embed __FILE__
++};
+diff --git a/gcc/testsuite/g++.dg/cpp/embed-16.C b/gcc/testsuite/g++.dg/cpp/embed-16.C
+new file mode 100644
+index 000000000000..868dce2f165c
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp/embed-16.C
+@@ -0,0 +1,18 @@
++// PR c++/118124
++// { dg-do compile { target c++11 } }
++// { dg-options "-O2" }
++// non-ASCII chars here: áéí
++
++namespace std {
++template <class T> struct initializer_list {
++private:
++  const T *_M_array;
++  __SIZE_TYPE__ _M_len;
++};
++}
++struct A {
++  A (std::initializer_list<signed char>);
++};
++A a {
++#embed __FILE__
++};	// { dg-error "narrowing conversion of '\[0-9]*' from 'int' to 'signed char'" }
+diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C b/gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C
+new file mode 100644
+index 000000000000..fa279882322d
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C
+@@ -0,0 +1,47 @@
++// PR c++/118124
++// { dg-do compile { target c++11 } }
++// { dg-options "-O2" }
++
++namespace std {
++template <class T> struct initializer_list {
++private:
++  const T *_M_array;
++  __SIZE_TYPE__ _M_len;
++};
++}
++struct A {
++  A (std::initializer_list<char>);
++};
++A a { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
++      8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
++      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
++      2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
++      4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
++      6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };
++struct B {
++  B (std::initializer_list<unsigned char>);
++};
++B b { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
++      8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
++      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
++      2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
++      4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
++      6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };
++struct C {
++  C (std::initializer_list<int>);
++};
++C c { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
++      8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
++      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
++      2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
++      4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
++      6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };
++struct D {
++  D (std::initializer_list<float>);
++};
++D d { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
++      8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
++      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
++      2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
++      4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
++      6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };
+diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C b/gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C
+new file mode 100644
+index 000000000000..080dee3cf026
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C
+@@ -0,0 +1,20 @@
++// PR c++/118124
++// { dg-do compile { target c++11 } }
++// { dg-options "-O2" }
++
++namespace std {
++template <class T> struct initializer_list {
++private:
++  const T *_M_array;
++  __SIZE_TYPE__ _M_len;
++};
++}
++struct A {
++  A (std::initializer_list<signed char>);
++};
++A a { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
++      8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
++      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
++      2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 209, 0, 1, 2, 3,
++      4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
++      6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };	// { dg-error "narrowing conversion of '209' from 'int' to 'signed char'" }
+
+base-commit: 670df03e5294a31efff1554c9a751ef893dc1f71
+-- 
+2.47.1
+

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index dcaecc1..425231d 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -3,6 +3,7 @@
 	- 77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
 	+ 77_all_PR118112-c-c-UX-improvements-to-too-few-many-arguments-errors.patch
 	+ 78_all_PR118032-Revert-gimple-Add-limit-after-which-slower-switchlow.patch
+	+ 79_all_PR118124-c-Fix-ICEs-with-large-initializer-lists-or-ones-i.patch
 
 32	16 December 2024
 


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-22 22:46 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-22 22:46 UTC (permalink / raw
  To: gentoo-commits

commit:     f7b94345a666909bdf29bdd73e9e35b362cc9f5e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 22 22:45:31 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec 22 22:45:31 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f7b94345

15.0.0: cut patchset 33

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

 15.0.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 425231d..95dd852 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,4 +1,4 @@
-33	????
+33	22 December 2024
 
 	- 77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch
 	+ 77_all_PR118112-c-c-UX-improvements-to-too-few-many-arguments-errors.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-24 20:48 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-24 20:48 UTC (permalink / raw
  To: gentoo-commits

commit:     afe723f516bec463e75e08da80cf1b8b093336c7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 24 20:47:40 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 24 20:47:56 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=afe723f5

15.0.0: update bashisms patch

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

 ...PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch | 2 +-
 15.0.0/gentoo/README.history                                          | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/15.0.0/gentoo/76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch b/15.0.0/gentoo/76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch
index 6011313..263204e 100644
--- a/15.0.0/gentoo/76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch
+++ b/15.0.0/gentoo/76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch
@@ -34,7 +34,7 @@ index d0a86acb832c..b140de0eb76d 100644
  # <http://www.gnu.org/licenses/>.
  
 -style="$1"
-+style="${1:-${NVPTX_GEN_COPYRIGHT}}"
++style="${NVPTX_GEN_COPYRIGHT}"
  case $style in
      opt)
      ;;

diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history
index 95dd852..69a95ed 100644
--- a/15.0.0/gentoo/README.history
+++ b/15.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+34	24 December 2024
+
+	U 76_all_PR117854-config-nvptx-fix-bashisms-with-gen-copyright.sh-use.patch
+
 33	22 December 2024
 
 	- 77_all_PR117980-ICE-cxx_eval_outermost_constant_expr.patch


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

* [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/
@ 2024-12-27 15:14 Sam James
  0 siblings, 0 replies; 116+ messages in thread
From: Sam James @ 2024-12-27 15:14 UTC (permalink / raw
  To: gentoo-commits

commit:     8043ac03bbd26d81e5476ed85b8e19b00e5cfc47
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 27 15:13:58 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 27 15:13:58 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=8043ac03

15.0.0: drop 79_all_PR118124-c-Fix-ICEs-with-large-initializer-lists-or-ones-i.patch

The C++ optimisation has been reverted for now upstream so this patch
isn't needed, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118124#c4.

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

 ...Es-with-large-initializer-lists-or-ones-i.patch | 307 ---------------------
 1 file changed, 307 deletions(-)

diff --git a/15.0.0/gentoo/79_all_PR118124-c-Fix-ICEs-with-large-initializer-lists-or-ones-i.patch b/15.0.0/gentoo/79_all_PR118124-c-Fix-ICEs-with-large-initializer-lists-or-ones-i.patch
deleted file mode 100644
index ded69c7..0000000
--- a/15.0.0/gentoo/79_all_PR118124-c-Fix-ICEs-with-large-initializer-lists-or-ones-i.patch
+++ /dev/null
@@ -1,307 +0,0 @@
-https://inbox.sourceware.org/gcc-patches/Z2U3spZjDr+xEZP0@tucnak/
-
-From b904875837cae597709d37ec45f70c70d353e901 Mon Sep 17 00:00:00 2001
-Message-ID: <b904875837cae597709d37ec45f70c70d353e901.1734693860.git.sam@gentoo.org>
-From: Jakub Jelinek <jakub@redhat.com>
-Date: Fri, 20 Dec 2024 10:24:02 +0100
-Subject: [PATCH] c++, v3: Fix ICEs with large initializer lists or ones
- including #embed [PR118124]
-
-On Thu, Dec 19, 2024 at 07:01:39PM +0100, Jakub Jelinek wrote:
-> So far lightly tested, ok for trunk this way if it passes bootstrap & testing?
-
-Bootstrap/regtest found an issue, warning about
-  if ()
-    for ()
-      if ()
-      else if ()
-      else
-so I've added {}s around it (no other changes from the previous patch).
-
-Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
-
-2024-12-20  Jakub Jelinek  <jakub@redhat.com>
-
-	PR c++/118124
-	* call.cc (convert_like_internal): Handle RAW_DATA_CST in
-	ck_list handling.  Formatting fixes.
-
-	* g++.dg/cpp/embed-15.C: New test.
-	* g++.dg/cpp/embed-16.C: New test.
-	* g++.dg/cpp0x/initlist-opt3.C: New test.
-	* g++.dg/cpp0x/initlist-opt4.C: New test.
----
- gcc/cp/call.cc                             | 84 ++++++++++++++++++++--
- gcc/testsuite/g++.dg/cpp/embed-15.C        | 35 +++++++++
- gcc/testsuite/g++.dg/cpp/embed-16.C        | 18 +++++
- gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C | 47 ++++++++++++
- gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C | 20 ++++++
- 5 files changed, 198 insertions(+), 6 deletions(-)
- create mode 100644 gcc/testsuite/g++.dg/cpp/embed-15.C
- create mode 100644 gcc/testsuite/g++.dg/cpp/embed-16.C
- create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C
- create mode 100644 gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C
-
-diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
-index c8420db568ea..27cea0db80af 100644
---- a/gcc/cp/call.cc
-+++ b/gcc/cp/call.cc
-@@ -8766,8 +8766,8 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
- 
- 	if (tree init = maybe_init_list_as_array (elttype, expr))
- 	  {
--	    elttype = cp_build_qualified_type
--	      (elttype, cp_type_quals (elttype) | TYPE_QUAL_CONST);
-+	    elttype = cp_build_qualified_type (elttype, cp_type_quals (elttype)
-+							| TYPE_QUAL_CONST);
- 	    array = build_array_of_n_type (elttype, len);
- 	    array = build_vec_init_expr (array, init, complain);
- 	    array = get_target_expr (array);
-@@ -8775,13 +8775,85 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
- 	  }
- 	else if (len)
- 	  {
--	    tree val; unsigned ix;
--
-+	    tree val;
-+	    unsigned ix;
- 	    tree new_ctor = build_constructor (init_list_type_node, NULL);
- 
- 	    /* Convert all the elements.  */
- 	    FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (expr), ix, val)
- 	      {
-+		if (TREE_CODE (val) == RAW_DATA_CST)
-+		  {
-+		    tree elt_type;
-+		    conversion *next;
-+		    /* For conversion to initializer_list<unsigned char> or
-+		       initializer_list<char> or initializer_list<signed char>
-+		       we can optimize and keep RAW_DATA_CST with adjusted
-+		       type if we report narrowing errors if needed, for
-+		       others this converts each element separately.  */
-+		    if (convs->u.list[ix]->kind == ck_std
-+			&& (elt_type = convs->u.list[ix]->type)
-+			&& (TREE_CODE (elt_type) == INTEGER_TYPE
-+			    || is_byte_access_type (elt_type))
-+			&& TYPE_PRECISION (elt_type) == CHAR_BIT
-+			&& (next = next_conversion (convs->u.list[ix]))
-+			&& next->kind == ck_identity)
-+		      {
-+			if (!TYPE_UNSIGNED (elt_type)
-+			    && (TYPE_UNSIGNED (TREE_TYPE (val))
-+				|| (TYPE_PRECISION (TREE_TYPE (val))
-+				    > CHAR_BIT)))
-+			  for (int i = 0; i < RAW_DATA_LENGTH (val); ++i)
-+			    {
-+			      if (RAW_DATA_SCHAR_ELT (val, i) >= 0)
-+				continue;
-+			      else if (complain & tf_error)
-+				{
-+				  location_t loc
-+				    = cp_expr_loc_or_input_loc (val);
-+				  int savederrorcount = errorcount;
-+				  permerror_opt (loc, OPT_Wnarrowing,
-+						 "narrowing conversion of "
-+						 "%qd from %qH to %qI",
-+						 RAW_DATA_UCHAR_ELT (val, i),
-+						 TREE_TYPE (val), elt_type);
-+				  if (errorcount != savederrorcount)
-+				    return error_mark_node;
-+				}
-+			      else
-+				return error_mark_node;
-+			    }
-+			tree sub = copy_node (val);
-+			TREE_TYPE (sub) = elt_type;
-+			CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_ctor),
-+						NULL_TREE, sub);
-+		      }
-+		    else
-+		      {
-+			for (int i = 0; i < RAW_DATA_LENGTH (val); ++i)
-+			  {
-+			    tree elt
-+			      = build_int_cst (TREE_TYPE (val),
-+					       RAW_DATA_UCHAR_ELT (val, i));
-+			    tree sub
-+			      = convert_like (convs->u.list[ix], elt,
-+					      fn, argnum, false, false,
-+					      /*nested_p=*/true, complain);
-+			    if (sub == error_mark_node)
-+			      return sub;
-+			    if (!check_narrowing (TREE_TYPE (sub), elt,
-+						  complain))
-+			      return error_mark_node;
-+			    tree nc = new_ctor;
-+			    CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (nc),
-+						    NULL_TREE, sub);
-+			    if (!TREE_CONSTANT (sub))
-+			      TREE_CONSTANT (new_ctor) = false;
-+			  }
-+		      }
-+		    len += RAW_DATA_LENGTH (val) - 1;
-+		    continue;
-+		  }
- 		tree sub = convert_like (convs->u.list[ix], val, fn,
- 					 argnum, false, false,
- 					 /*nested_p=*/true, complain);
-@@ -8796,8 +8868,8 @@ convert_like_internal (conversion *convs, tree expr, tree fn, int argnum,
- 		  TREE_CONSTANT (new_ctor) = false;
- 	      }
- 	    /* Build up the array.  */
--	    elttype = cp_build_qualified_type
--	      (elttype, cp_type_quals (elttype) | TYPE_QUAL_CONST);
-+	    elttype = cp_build_qualified_type (elttype, cp_type_quals (elttype)
-+							| TYPE_QUAL_CONST);
- 	    array = build_array_of_n_type (elttype, len);
- 	    array = finish_compound_literal (array, new_ctor, complain);
- 	    /* This is dubious now, should be blessed by P2752.  */
-diff --git a/gcc/testsuite/g++.dg/cpp/embed-15.C b/gcc/testsuite/g++.dg/cpp/embed-15.C
-new file mode 100644
-index 000000000000..a3994536e576
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/cpp/embed-15.C
-@@ -0,0 +1,35 @@
-+// PR c++/118124
-+// { dg-do compile { target c++11 } }
-+// { dg-options "-O2" }
-+
-+namespace std {
-+template <class T> struct initializer_list {
-+private:
-+  const T *_M_array;
-+  __SIZE_TYPE__ _M_len;
-+};
-+}
-+struct A {
-+  A (std::initializer_list<char>);
-+};
-+A a {
-+#embed __FILE__
-+};
-+struct B {
-+  B (std::initializer_list<unsigned char>);
-+};
-+B b {
-+#embed __FILE__
-+};
-+struct C {
-+  C (std::initializer_list<int>);
-+};
-+C c {
-+#embed __FILE__
-+};
-+struct D {
-+  D (std::initializer_list<float>);
-+};
-+D d {
-+#embed __FILE__
-+};
-diff --git a/gcc/testsuite/g++.dg/cpp/embed-16.C b/gcc/testsuite/g++.dg/cpp/embed-16.C
-new file mode 100644
-index 000000000000..868dce2f165c
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/cpp/embed-16.C
-@@ -0,0 +1,18 @@
-+// PR c++/118124
-+// { dg-do compile { target c++11 } }
-+// { dg-options "-O2" }
-+// non-ASCII chars here: áéí
-+
-+namespace std {
-+template <class T> struct initializer_list {
-+private:
-+  const T *_M_array;
-+  __SIZE_TYPE__ _M_len;
-+};
-+}
-+struct A {
-+  A (std::initializer_list<signed char>);
-+};
-+A a {
-+#embed __FILE__
-+};	// { dg-error "narrowing conversion of '\[0-9]*' from 'int' to 'signed char'" }
-diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C b/gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C
-new file mode 100644
-index 000000000000..fa279882322d
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C
-@@ -0,0 +1,47 @@
-+// PR c++/118124
-+// { dg-do compile { target c++11 } }
-+// { dg-options "-O2" }
-+
-+namespace std {
-+template <class T> struct initializer_list {
-+private:
-+  const T *_M_array;
-+  __SIZE_TYPE__ _M_len;
-+};
-+}
-+struct A {
-+  A (std::initializer_list<char>);
-+};
-+A a { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
-+      8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
-+      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
-+      2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
-+      4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
-+      6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };
-+struct B {
-+  B (std::initializer_list<unsigned char>);
-+};
-+B b { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
-+      8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
-+      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
-+      2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
-+      4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
-+      6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };
-+struct C {
-+  C (std::initializer_list<int>);
-+};
-+C c { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
-+      8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
-+      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
-+      2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
-+      4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
-+      6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };
-+struct D {
-+  D (std::initializer_list<float>);
-+};
-+D d { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
-+      8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
-+      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
-+      2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
-+      4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
-+      6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };
-diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C b/gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C
-new file mode 100644
-index 000000000000..080dee3cf026
---- /dev/null
-+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C
-@@ -0,0 +1,20 @@
-+// PR c++/118124
-+// { dg-do compile { target c++11 } }
-+// { dg-options "-O2" }
-+
-+namespace std {
-+template <class T> struct initializer_list {
-+private:
-+  const T *_M_array;
-+  __SIZE_TYPE__ _M_len;
-+};
-+}
-+struct A {
-+  A (std::initializer_list<signed char>);
-+};
-+A a { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
-+      8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
-+      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
-+      2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 209, 0, 1, 2, 3,
-+      4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
-+      6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };	// { dg-error "narrowing conversion of '209' from 'int' to 'signed char'" }
-
-base-commit: 670df03e5294a31efff1554c9a751ef893dc1f71
--- 
-2.47.1
-


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

end of thread, other threads:[~2024-12-27 15:14 UTC | newest]

Thread overview: 116+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-22 22:46 [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-12-27 15:14 Sam James
2024-12-24 20:48 Sam James
2024-12-20 11:25 Sam James
2024-12-20  5:57 Sam James
2024-12-20  1:55 Sam James
2024-12-19 18:34 Sam James
2024-12-13 13:23 Sam James
2024-12-13 11:52 Sam James
2024-12-13  5:08 Sam James
2024-12-12 12:28 Sam James
2024-12-11  4:41 Sam James
2024-12-11  0:58 Sam James
2024-12-10 19:19 Sam James
2024-12-10 14:55 Sam James
2024-12-10  5:19 Sam James
2024-12-10  5:13 Sam James
2024-12-10  5:11 Sam James
2024-12-10  5:07 Sam James
2024-12-09  3:05 Sam James
2024-12-08 22:41 Sam James
2024-12-06 17:33 Sam James
2024-12-04 20:40 Sam James
2024-12-01 22:51 Sam James
2024-12-01 22:51 Sam James
2024-11-30 11:30 Sam James
2024-11-27 17:42 Sam James
2024-11-25 15:10 Sam James
2024-11-25  3:01 Sam James
2024-11-25  3:00 Sam James
2024-11-25  3:00 Sam James
2024-11-24 22:42 Sam James
2024-11-18 17:25 Sam James
2024-11-18 10:42 Sam James
2024-11-18 10:42 Sam James
2024-11-18  9:25 Sam James
2024-11-18  9:25 Sam James
2024-11-14 18:38 Sam James
2024-11-13  4:26 Sam James
2024-11-13  0:16 Sam James
2024-11-12  2:33 Sam James
2024-11-11 19:46 Sam James
2024-11-11 19:46 Sam James
2024-11-10 22:41 Sam James
2024-11-09 16:24 Sam James
2024-11-09  7:55 Sam James
2024-11-08  8:22 Sam James
2024-11-07 16:13 Sam James
2024-11-03 23:16 Sam James
2024-11-01  8:24 Sam James
2024-11-01  8:24 Sam James
2024-11-01  8:18 Sam James
2024-11-01  8:17 Sam James
2024-10-30 16:03 Sam James
2024-10-29 19:17 Sam James
2024-10-28 21:32 Sam James
2024-10-28  8:09 Sam James
2024-10-23 15:40 Sam James
2024-10-22 19:09 Sam James
2024-10-22 18:34 Sam James
2024-10-21 12:33 Sam James
2024-10-21 12:27 Sam James
2024-10-21 12:26 Sam James
2024-10-21 11:45 Sam James
2024-10-20 22:42 Sam James
2024-10-18 14:05 Sam James
2024-10-18 10:35 Sam James
2024-10-17 23:33 Sam James
2024-10-17 23:03 Sam James
2024-10-17  5:01 Sam James
2024-10-17  4:15 Sam James
2024-10-13 22:48 Sam James
2024-10-07  2:45 Sam James
2024-10-04 10:37 Sam James
2024-10-04  9:28 Sam James
2024-10-02 19:45 Sam James
2024-09-30 14:05 Sam James
2024-09-29 22:56 Sam James
2024-09-24  1:41 Sam James
2024-09-23 15:23 Sam James
2024-09-02  2:28 Sam James
2024-08-26 13:44 Sam James
2024-08-26  6:24 Sam James
2024-08-23 13:51 Sam James
2024-08-20 20:31 Sam James
2024-08-19 18:43 Sam James
2024-08-14  9:48 Sam James
2024-08-14  2:57 Sam James
2024-08-11 22:40 Sam James
2024-08-09 19:54 Sam James
2024-08-09 19:54 Sam James
2024-08-09 19:47 Sam James
2024-08-09 19:25 Sam James
2024-08-08 11:10 Sam James
2024-08-08 11:06 Sam James
2024-08-08 11:03 Sam James
2024-08-05  9:09 Sam James
2024-08-05  1:54 Sam James
2024-08-05  1:51 Sam James
2024-08-02 20:39 Sam James
2024-08-01 14:40 Sam James
2024-07-28 23:34 Sam James
2024-07-22  1:11 Sam James
2024-07-19 11:14 Sam James
2024-07-18  0:45 Sam James
2024-07-14 23:36 Sam James
2024-06-28 12:49 Sam James
2024-06-27  0:02 Sam James
2024-06-26 23:57 Sam James
2024-06-16 22:45 Sam James
2024-06-10 20:18 Sam James
2024-06-10 17:28 Sam James
2024-06-10 17:28 Sam James
2024-06-10  2:08 Sam James
2024-06-08 17:03 Sam James
2024-06-08 17:03 Sam James

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