From a09ccc22459c565814f79f96586fe4ad083fe4eb Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Sat, 21 Dec 2019 12:25:05 +0100 Subject: [PATCH] Avoid segfault when doing IPA-VRP but not IPA-CP (PR 93015) 2019-12-21 Martin Jambor PR ipa/93015 * ipa-cp.c (ipcp_store_vr_results): Check that info exists testsuite/ * gcc.dg/lto/pr93015_0.c: New test. From-SVN: r279695 --- gcc/ChangeLog | 5 +++++ gcc/ipa-cp.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/lto/pr93015_0.c | 6 ++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/lto/pr93015_0.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6afc0177f21..11a404c625c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-12-21 Martin Jambor + + PR ipa/93015 + * ipa-cp.c (ipcp_store_vr_results): Check that info exists + 2019-12-20 Michael Meissner * config/rs6000/predicates.md (cint34_operand): Use diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 126d154318c..ee725974391 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -5728,7 +5728,7 @@ ipcp_store_vr_results (void) ipa_node_params *info = IPA_NODE_REF (node); bool found_useful_result = false; - if (!opt_for_fn (node->decl, flag_ipa_vrp)) + if (!info || !opt_for_fn (node->decl, flag_ipa_vrp)) { if (dump_file) fprintf (dump_file, "Not considering %s for VR discovery " diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a7bffea3bd4..8ec9fc2e604 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-12-21 Martin Jambor + + PR ipa/93015 + * gcc.dg/lto/pr93015_0.c: New test. + 2019-12-19 Marek Polacek PR c++/92745 - bogus error when initializing array of vectors. diff --git a/gcc/testsuite/gcc.dg/lto/pr93015_0.c b/gcc/testsuite/gcc.dg/lto/pr93015_0.c new file mode 100644 index 00000000000..d084b5ad1e2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr93015_0.c @@ -0,0 +1,6 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -O0 -fipa-vrp -flto } } } */ + +int main() { + +} -- 2.30.2