diff mbox series

Avoid segfault when dumping IPA-CP lattices for unoptimized functions (PR 92917)

Message ID ri68smomzix.fsf@suse.cz
State New
Headers show
Series Avoid segfault when dumping IPA-CP lattices for unoptimized functions (PR 92917) | expand

Commit Message

Martin Jambor Jan. 3, 2020, 1:37 p.m. UTC
Hi,

PR 92917 found yet another place - dumping - where we can no longer rely
on the fact that each function with gimple body has its ipa_node_params
summary because un-optimized ones don't.  Fixed with the following
obvious patch that has passed a bootstrap and testing on an x86_64 and
which I am going to commit now.

Thanks,

Martin


2020-01-02  Martin Jambor  <mjambor@suse.cz>

	PR ipa/92917
	* ipa-cp.c (print_all_lattices): Skip functions without info.
---
 gcc/ipa-cp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 43c0d5a6706..4381b35a809 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -543,8 +543,9 @@  print_all_lattices (FILE * f, bool dump_sources, bool dump_benefits)
       class ipa_node_params *info;
 
       info = IPA_NODE_REF (node);
-      /* Skip constprop clones since we don't make lattices for them.  */
-      if (info->ipcp_orig_node)
+      /* Skip unoptimized functions and constprop clones since we don't make
+	 lattices for them.  */
+      if (!info || info->ipcp_orig_node)
 	continue;
       fprintf (f, "  Node: %s:\n", node->dump_name ());
       count = ipa_get_param_count (info);