From: Martin Jambor Date: Wed, 13 Nov 2019 14:12:58 +0000 (+0100) Subject: Add a few missing checks that IPA_NODE_REF is not NULL (PR 92454) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3c4fa8a8562d3788bb763ca5c8fb1563b8d4eb1a;p=gcc.git Add a few missing checks that IPA_NODE_REF is not NULL (PR 92454) 2019-11-13 Jan Hubicka Martin Jambor PR ipa/92454 * ipa-cp.c (spread_undeadness): Check that IPA_NODE_REF exists. (identify_dead_nodes): Likewise. testsuite/ * g++.dg/ipa/pr92454.C: New test. From-SVN: r278142 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5375cd5f7fa..05046e6b1b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-11-13 Jan Hubicka + Martin Jambor + + PR ipa/92454 + * ipa-cp.c (spread_undeadness): Check that IPA_NODE_REF exists. + (identify_dead_nodes): Likewise. + 2019-11-13 Martin Liska * ipa-icf.c (sem_function::equals_private): Do not overuse diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 54b9724998a..207d7c88bbd 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -4979,7 +4979,7 @@ spread_undeadness (struct cgraph_node *node) callee = cs->callee->function_symbol (NULL); info = IPA_NODE_REF (callee); - if (info->node_dead) + if (info && info->node_dead) { info->node_dead = 0; spread_undeadness (callee); @@ -5017,18 +5017,19 @@ identify_dead_nodes (struct cgraph_node *node) struct cgraph_node *v; for (v = node; v; v = ((struct ipa_dfs_info *) v->aux)->next_cycle) if (v->local + && IPA_NODE_REF (v) && !v->call_for_symbol_thunks_and_aliases (has_undead_caller_from_outside_scc_p, NULL, true)) IPA_NODE_REF (v)->node_dead = 1; for (v = node; v; v = ((struct ipa_dfs_info *) v->aux)->next_cycle) - if (!IPA_NODE_REF (v)->node_dead) + if (IPA_NODE_REF (v) && !IPA_NODE_REF (v)->node_dead) spread_undeadness (v); if (dump_file && (dump_flags & TDF_DETAILS)) { for (v = node; v; v = ((struct ipa_dfs_info *) v->aux)->next_cycle) - if (IPA_NODE_REF (v)->node_dead) + if (IPA_NODE_REF (v) && IPA_NODE_REF (v)->node_dead) fprintf (dump_file, " Marking node as dead: %s.\n", v->dump_name ()); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1993960909f..23ad51b785c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-11-13 Martin Jambor + + PR ipa/92454 + * ipa-cp.c (spread_undeadness): Check that IPA_NODE_REF exists. + (identify_dead_nodes): Likewise. + 2019-11-13 Martin Liska * gcc.dg/ipa/ipa-icf-39.c: Update -fdbg-cnt to the new format. diff --git a/gcc/testsuite/g++.dg/ipa/pr92454.C b/gcc/testsuite/g++.dg/ipa/pr92454.C new file mode 100644 index 00000000000..de67c66aed0 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr92454.C @@ -0,0 +1,38 @@ +/* Originally PR ipa/91969, options adjusted for PR ipa/92454 */ +/* { dg-options "-O3 --param ipa-cp-eval-threshold=1" } */ + +enum by +{ +}; +class A +{ +public: + class B + { + public: + virtual void m_fn2 (by) = 0; + }; + virtual int m_fn1 (); + B *cf; +}; +by a; +class C : A, A::B +{ + void m_fn2 (by); +}; +void C::m_fn2 (by) { cf->m_fn2 (a); } + +struct a +{ + virtual ~a (); +}; + +struct b +{ + virtual void d (...); +}; + +struct c : a, b +{ + void d (...) {} +};