aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-03-27 16:13:54 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2015-03-27 15:13:54 +0000
commit931c8e9a04bd7cb7c8f372a77e8061c46b19a742 (patch)
tree4730bf114427a89a09662f96bb28dfa1992ea3bf
parentd81c5030d1ca9920bc41de91819cef17c83a8805 (diff)
downloadgcc-931c8e9a04bd7cb7c8f372a77e8061c46b19a742.zip
gcc-931c8e9a04bd7cb7c8f372a77e8061c46b19a742.tar.gz
gcc-931c8e9a04bd7cb7c8f372a77e8061c46b19a742.tar.bz2
re PR ipa/65600 (bost testsuite failure: ICE: Segmentation fault)
PR ipa/65600 * cgraph.c (cgraph_update_edges_for_call_stmt_node): Fix the case of optimized out indirect call. (redirect_to_unreachable): Always build symbol table node for BUILT_IN_UNREACHABLE * g++.dg/torture/pr65600.C: New testcase. From-SVN: r221735
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/cgraph.c2
-rw-r--r--gcc/ipa-inline-analysis.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/torture/pr65600.C28
5 files changed, 47 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 05b193b..0f0a6f5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2015-03-27 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/65600
+ * cgraph.c (cgraph_update_edges_for_call_stmt_node): Fix the case
+ of optimized out indirect call.
+ (redirect_to_unreachable): Always build symbol table node for
+ BUILT_IN_UNREACHABLE
+
2015-03-27 Vladimir Makarov <vmakarov@redhat.com>
PR target/65407
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 96f5f40..85531c8 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1516,7 +1516,7 @@ cgraph_update_edges_for_call_stmt_node (cgraph_node *node,
if (e)
{
/* Keep calls marked as dead dead. */
- if (new_call && e->callee
+ if (new_stmt && is_gimple_call (new_stmt) && e->callee
&& DECL_BUILT_IN_CLASS (e->callee->decl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (e->callee->decl) == BUILT_IN_UNREACHABLE)
{
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index a9d885f..2f4eb9f 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -766,15 +766,15 @@ static struct cgraph_edge *
redirect_to_unreachable (struct cgraph_edge *e)
{
struct cgraph_node *callee = !e->inline_failed ? e->callee : NULL;
+ struct cgraph_node *target = cgraph_node::get_create
+ (builtin_decl_implicit (BUILT_IN_UNREACHABLE));
if (e->speculative)
- e = e->resolve_speculation (builtin_decl_implicit (BUILT_IN_UNREACHABLE));
+ e = e->resolve_speculation (target->decl);
else if (!e->callee)
- e->make_direct (cgraph_node::get_create
- (builtin_decl_implicit (BUILT_IN_UNREACHABLE)));
+ e->make_direct (target);
else
- e->redirect_callee (cgraph_node::get_create
- (builtin_decl_implicit (BUILT_IN_UNREACHABLE)));
+ e->redirect_callee (target);
struct inline_edge_summary *es = inline_edge_summary (e);
e->inline_failed = CIF_UNREACHABLE;
e->frequency = 0;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 69a1cda..c1adea5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-27 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/65600
+ * g++.dg/torture/pr65600.C: New testcase.
+
2015-03-27 Vladimir Makarov <vmakarov@redhat.com>
PR target/65407
diff --git a/gcc/testsuite/g++.dg/torture/pr65600.C b/gcc/testsuite/g++.dg/torture/pr65600.C
new file mode 100644
index 0000000..2ee5a4b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr65600.C
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+class A {
+public:
+ virtual void m_fn1() {}
+ int weak_release___trans_tmp_1;
+ void m_fn2() {
+ __asm__("\n\n\n\n");
+ if (weak_release___trans_tmp_1)
+ m_fn1();
+ }
+};
+class weak_count {
+ A *pi_;
+
+public:
+ weak_count() : pi_() {}
+ ~weak_count() {
+ if (pi_)
+ pi_->m_fn2();
+ }
+};
+class B {
+ weak_count pn;
+};
+int
+main() { B a; }
+