commit:     7c21ad7fdb7c7bf93e1a17a60756da03a21b16e7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 15 21:21:25 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan 15 21:21:25 2026 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=7c21ad7f

16.0.0: fix ipa-cp crash

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

 16.0.0/gentoo/87_all_PR123619-ipa-cp.patch | 81 ++++++++++++++++++++++++++++++
 16.0.0/gentoo/README.history               |  4 ++
 2 files changed, 85 insertions(+)

diff --git a/16.0.0/gentoo/87_all_PR123619-ipa-cp.patch 
b/16.0.0/gentoo/87_all_PR123619-ipa-cp.patch
new file mode 100644
index 0000000..a3df1c4
--- /dev/null
+++ b/16.0.0/gentoo/87_all_PR123619-ipa-cp.patch
@@ -0,0 +1,81 @@
+https://gcc.gnu.org/PR123587
+https://gcc.gnu.org/PR123619
+https://gcc.gnu.org/pipermail/gcc-patches/2025-December/702974.html
+--- a/gcc/cgraph.h
++++ b/gcc/cgraph.h
+@@ -1684,8 +1684,11 @@ public:
+ 
+   /* Return TRUE if context is fully useless.  */
+   bool useless_p () const;
+-  /* Return TRUE if this context conveys the same information as X.  */
+-  bool equal_to (const ipa_polymorphic_call_context &x) const;
++  /* Return TRUE if this context conveys the same information as X.  If
++     STRICT_SPECULATION is true, compare the speculative part even when it is
++     inconsistent.  */
++  bool equal_to (const ipa_polymorphic_call_context &x,
++               bool strict_speculation = false) const;
+ 
+   /* Dump human readable context to F.  If NEWLINE is true, it will be
+      terminated by a newline.  */
+--- a/gcc/ipa-cp.cc
++++ b/gcc/ipa-cp.cc
+@@ -2026,7 +2026,7 @@ static bool
+ values_equal_for_ipcp_p (ipa_polymorphic_call_context x,
+                        ipa_polymorphic_call_context y)
+ {
+-  return x.equal_to (y);
++  return x.equal_to (y, true);
+ }
+ 
+ 
+--- a/gcc/ipa-polymorphic-call.cc
++++ b/gcc/ipa-polymorphic-call.cc
+@@ -2368,11 +2368,13 @@ 
ipa_polymorphic_call_context::possible_dynamic_type_change (bool in_poly_cdtor,
+     maybe_in_construction = true;
+ }
+ 
+-/* Return TRUE if this context conveys the same information as OTHER.  */
++/* Return TRUE if this context conveys the same information as X.  If
++   STRICT_SPECULATION is true, compare the speculative part even when it is
++   inconsistent.  */
+ 
+ bool
+ ipa_polymorphic_call_context::equal_to
+-    (const ipa_polymorphic_call_context &x) const
++(const ipa_polymorphic_call_context &x, bool strict_speculation) const
+ {
+   if (useless_p ())
+     return x.useless_p ();
+@@ -2397,8 +2399,11 @@ ipa_polymorphic_call_context::equal_to
+ 
+ 
+   if (speculative_outer_type
+-      && speculation_consistent_p (speculative_outer_type, speculative_offset,
+-                                 speculative_maybe_derived_type, NULL_TREE))
++      && (strict_speculation
++        || speculation_consistent_p (speculative_outer_type,
++                                     speculative_offset,
++                                     speculative_maybe_derived_type,
++                                     NULL_TREE)))
+     {
+       if (!x.speculative_outer_type)
+       return false;
+@@ -2412,10 +2417,11 @@ ipa_polymorphic_call_context::equal_to
+       return false;
+     }
+   else if (x.speculative_outer_type
+-         && x.speculation_consistent_p (x.speculative_outer_type,
+-                                        x.speculative_offset,
+-                                        x.speculative_maybe_derived_type,
+-                                        NULL))
++         && (strict_speculation
++             || x.speculation_consistent_p (x.speculative_outer_type,
++                                            x.speculative_offset,
++                                            x.speculative_maybe_derived_type,
++                                            NULL)))
+     return false;
+ 
+   return true;
+-- 
+2.51.1
+

diff --git a/16.0.0/gentoo/README.history b/16.0.0/gentoo/README.history
index 1a8f6d6..fa5ee2b 100644
--- a/16.0.0/gentoo/README.history
+++ b/16.0.0/gentoo/README.history
@@ -1,3 +1,7 @@
+32     ????
+
+       + 87_all_PR123619-ipa-cp.patch
+
 31     13 January 2026
 
        - 87_all_PR123517-ipa-cp-revert.patch

Reply via email to