Avoid segfault when doing IPA-VRP but not IPA-CP (PR 93015)
authorMartin Jambor <mjambor@suse.cz>
Sat, 21 Dec 2019 11:25:05 +0000 (12:25 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Sat, 21 Dec 2019 11:25:05 +0000 (12:25 +0100)
2019-12-21  Martin Jambor  <mjambor@suse.cz>

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
gcc/ipa-cp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/lto/pr93015_0.c [new file with mode: 0644]

index 6afc0177f2134290c35b1ae6173a383604e3fe6e..11a404c625cddd1a74970c9478224ef13e31843b 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-21  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/93015
+       * ipa-cp.c (ipcp_store_vr_results): Check that info exists
+
 2019-12-20   Michael Meissner  <meissner@linux.ibm.com>
 
        * config/rs6000/predicates.md (cint34_operand): Use
index 126d154318cc608accc5a2e61a156e02b60891e5..ee7259743918d8a554d0a8f8ea59a0573ae0abfe 100644 (file)
@@ -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 "
index a7bffea3bd4a5c806c9ebe8995372f03c4120e98..8ec9fc2e6041a07d61a4dcff1c098f6fb050d87e 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-21  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/93015
+       * gcc.dg/lto/pr93015_0.c: New test.
+
 2019-12-19  Marek Polacek  <polacek@redhat.com>
 
        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 (file)
index 0000000..d084b5a
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options { { -O0 -fipa-vrp -flto } } } */
+
+int main() {
+
+}