aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfgcleanup.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-08-17 15:56:30 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-08-17 15:56:30 +0200
commit458a1cd089646f1308c6c19573d095852f10d91d (patch)
tree1eeb4e157a1fda36611f079637227095e54c6a8c /gcc/tree-cfgcleanup.c
parent37144e84aaacf4b5fe10692b9c7c690fb47df224 (diff)
downloadgcc-458a1cd089646f1308c6c19573d095852f10d91d.zip
gcc-458a1cd089646f1308c6c19573d095852f10d91d.tar.gz
gcc-458a1cd089646f1308c6c19573d095852f10d91d.tar.bz2
re PR middle-end/77259 (ICE in emit_move_insn since r232167)
PR middle-end/77259 * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): If turning a call into __builtin_unreachable-like noreturn call, adjust gimple_call_set_fntype. * tree-cfgcleanup.c (fixup_noreturn_call): Remove lhs also if gimple_call_fntype has void return type. * g++.dg/ipa/devirt-52.C: New test. From-SVN: r239537
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r--gcc/tree-cfgcleanup.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 3fe0d3e..6052872 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -602,9 +602,14 @@ fixup_noreturn_call (gimple *stmt)
/* If there is an LHS, remove it, but only if its type has fixed size.
The LHS will need to be recreated during RTL expansion and creating
temporaries of variable-sized types is not supported. Also don't
- do this with TREE_ADDRESSABLE types, as assign_temp will abort. */
+ do this with TREE_ADDRESSABLE types, as assign_temp will abort.
+ Drop LHS regardless of TREE_ADDRESSABLE, if the function call
+ has been changed into a call that does not return a value, like
+ __builtin_unreachable or __cxa_pure_virtual. */
tree lhs = gimple_call_lhs (stmt);
- if (should_remove_lhs_p (lhs))
+ if (lhs
+ && (should_remove_lhs_p (lhs)
+ || VOID_TYPE_P (TREE_TYPE (gimple_call_fntype (stmt)))))
{
gimple_call_set_lhs (stmt, NULL_TREE);