aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2020-07-26 11:34:45 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2020-07-26 11:34:45 +0100
commit8f9b6cda0cd772b5155d52a5effabd04fd656a18 (patch)
tree722bf0cfbe009335811f0f49a6b1abfc217b62b5
parent4.9.4: tweak to build against gcc-11 (diff)
downloadgcc-patches-8f9b6cda0cd772b5155d52a5effabd04fd656a18.tar.gz
gcc-patches-8f9b6cda0cd772b5155d52a5effabd04fd656a18.tar.bz2
gcc-patches-8f9b6cda0cd772b5155d52a5effabd04fd656a18.zip
10.2.0: fix IPA ICE on LTO -O0/-O2 mix
Bug: https://bugs.gentoo.org/733482 Bug: https://gcc.gnu.org/PR96291 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rw-r--r--10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch46
-rw-r--r--10.2.0/gentoo/README.history3
2 files changed, 49 insertions, 0 deletions
diff --git a/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch
new file mode 100644
index 0000000..b163721
--- /dev/null
+++ b/10.2.0/gentoo/33_all_lto-O0-mix-ICE-ipa-PR96291.patch
@@ -0,0 +1,46 @@
+https://bugs.gentoo.org/733482
+https://gcc.gnu.org/PR96291
+
+From 03810b1b2dec00575b2bcb579eb3d7c34bd176bc Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <siarheit@google.com>
+Date: Sat, 25 Jul 2020 19:26:50 +0100
+Subject: [PATCH] ipa/96291: don't crash on unoptimized lto functions
+
+In PR ipa/96291 the test contained an SCC with one
+unoptimized function. This tricked ipa-cp into NULL dereference.
+
+has_undead_caller_from_outside_scc_p() did not take into account
+that unoptimized funtions don't have IPA summary analysis. and
+dereferenced NULL pointer causing an ICE.
+
+ PR ipa/96291
+ * ipa-cp.c (has_undead_caller_from_outside_scc_p): Consider
+ unoptimized callers as undead.
+---
+ gcc/ipa-cp.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+--- a/gcc/ipa-cp.c
++++ b/gcc/ipa-cp.c
+@@ -5666,9 +5666,15 @@ has_undead_caller_from_outside_scc_p (struct cgraph_node *node,
+ && cs->caller->call_for_symbol_thunks_and_aliases
+ (has_undead_caller_from_outside_scc_p, NULL, true))
+ return true;
+- else if (!ipa_edge_within_scc (cs)
+- && !IPA_NODE_REF (cs->caller)->node_dead)
+- return true;
++ else if (!ipa_edge_within_scc (cs))
++ {
++ /* Unoptimized callers don't have IPA information.
++ Conservatively assume callers are undead. */
++ if (!IPA_NODE_REF (cs->caller))
++ return true;
++ if (!IPA_NODE_REF (cs->caller)->node_dead)
++ return true;
++ }
+ return false;
+ }
+
+--
+2.27.0
+
diff --git a/10.2.0/gentoo/README.history b/10.2.0/gentoo/README.history
index 4009f39..1c0fff9 100644
--- a/10.2.0/gentoo/README.history
+++ b/10.2.0/gentoo/README.history
@@ -1,3 +1,6 @@
+2 TODO
+ + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch
+
1 23 July 2020
+ 01_all_default-fortify-source.patch
+ 02_all_default-warn-format-security.patch