This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR ipa/66896


Hello.

Following patch fixes $subject, which can be spotted on gcc-5-branch, while trunk
looks fine (even though it can potentially suffer from the same issues).

Patch can both survive regression tests on trunk and gcc-5-branch on x86_64-linux-pc.

Ready for both branches?
Thanks,
Martin
>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

diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 34e4826..3415856 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.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
diff --git a/gcc/testsuite/g++.dg/ipa/pr66896.C b/gcc/testsuite/g++.dg/ipa/pr66896.C
new file mode 100644
index 0000000..236537a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr66896.C
@@ -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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]