From d6322e2c665cb45e1d44d9549ac5149ec10a667a Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Thu, 16 Jul 2015 14:19:32 +0200
Subject: [PATCH] Fix PR ipa/66896.
gcc/testsuite/ChangeLog:
2015-07-16 Martin Liska <mliska@suse.cz>
* g++.dg/ipa/pr66896.c: New test.
gcc/ChangeLog:
2015-07-16 Martin Liska <mliska@suse.cz>
PR ipa/66896.
* ipa-prop.c (update_jump_functions_after_inlining): Create properly
dst_ctx if it does not exist.
---
gcc/ipa-prop.c | 12 ++++++++----
gcc/testsuite/g++.dg/ipa/pr66896.C | 22 ++++++++++++++++++++++
2 files changed, 30 insertions(+), 4 deletions(-)
create mode 100644 gcc/testsuite/g++.dg/ipa/pr66896.C
@@ -2377,11 +2377,15 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
ctx.offset_by (dst->value.ancestor.offset);
if (!ctx.useless_p ())
{
- vec_safe_grow_cleared (args->polymorphic_call_contexts,
- count);
- dst_ctx = ipa_get_ith_polymorhic_call_context (args, i);
+ if (!dst_ctx)
+ {
+ vec_safe_grow_cleared (args->polymorphic_call_contexts,
+ count);
+ dst_ctx = ipa_get_ith_polymorhic_call_context (args, i);
+ }
+
+ dst_ctx->combine_with (ctx);
}
- dst_ctx->combine_with (ctx);
}
if (src->agg.items
new file mode 100644
@@ -0,0 +1,22 @@
+// PR ipa/66896
+// { dg-do compile }
+
+void f2 (void *);
+void f3 ();
+
+struct A
+{
+ int *a;
+ A ();
+ ~A () { a3 (); }
+ int a1 (int * p) { if (!p) f3 (); f2 (p); }
+ void a3 () { if (*a) a1 (a); }
+};
+
+struct B : A {~B () { a3 ();}};
+
+struct F {};
+
+struct G : F {B g;};
+
+void foo () {G g;}
--
2.4.5