aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-10-15 21:02:33 +1030
committerAlan Modra <amodra@gcc.gnu.org>2011-10-15 21:02:33 +1030
commit387748de2fd017a990aaf617f24b8dad53856888 (patch)
treecb30b59e8583f834cc2b7bda3848e3270cd9bcf1 /gcc
parentc225ba500b4c34dde743798bf9ccb5dcef7af832 (diff)
downloadgcc-387748de2fd017a990aaf617f24b8dad53856888.zip
gcc-387748de2fd017a990aaf617f24b8dad53856888.tar.gz
gcc-387748de2fd017a990aaf617f24b8dad53856888.tar.bz2
re PR rtl-optimization/49941 (segmentation fault in redirect_jump_2)
PR rtl-optimization/49941 * jump.c (mark_jump_label_1): Set JUMP_LABEL for simple_return jumps. * rtl.h (set_return_jump_label): Declare. * function.c (set_return_jump_label): New function, extracted.. (thread_prologue_and_epilogue_insns): ..from here. Use it in another instance to set return jump_label. * cfgrtl.c (force_nonfallthru_and_redirect): Use set_return_jump_label. * reorg.c (find_end_label): Likewise. From-SVN: r180027
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/cfgrtl.c2
-rw-r--r--gcc/function.c26
-rw-r--r--gcc/jump.c3
-rw-r--r--gcc/reorg.c2
-rw-r--r--gcc/rtl.h1
6 files changed, 33 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2bc40b0..960b79b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2011-10-15 Alan Modra <amodra@gmail.com>
+
+ PR rtl-optimization/49941
+ * jump.c (mark_jump_label_1): Set JUMP_LABEL for simple_return jumps.
+
+ * rtl.h (set_return_jump_label): Declare.
+ * function.c (set_return_jump_label): New function, extracted..
+ (thread_prologue_and_epilogue_insns): ..from here. Use it in
+ another instance to set return jump_label.
+ * cfgrtl.c (force_nonfallthru_and_redirect): Use set_return_jump_label.
+ * reorg.c (find_end_label): Likewise.
+
2011-10-14 David S. Miller <davem@davemloft.net>
* config/sparc/sol2.h: Protect -m{cpu,tune}=native handling
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index b3f045b..f06dbc8 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1273,7 +1273,7 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
gcc_unreachable ();
#endif
}
- JUMP_LABEL (BB_END (jump_block)) = jump_label;
+ set_return_jump_label (BB_END (jump_block));
}
else
{
diff --git a/gcc/function.c b/gcc/function.c
index c469ab9..c3702fb 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5527,6 +5527,20 @@ emit_return_into_block (bool simple_p, basic_block bb)
}
#endif
+/* Set JUMP_LABEL for a return insn. */
+
+void
+set_return_jump_label (rtx returnjump)
+{
+ rtx pat = PATTERN (returnjump);
+ if (GET_CODE (pat) == PARALLEL)
+ pat = XVECEXP (pat, 0, 0);
+ if (ANY_RETURN_P (pat))
+ JUMP_LABEL (returnjump) = pat;
+ else
+ JUMP_LABEL (returnjump) = ret_rtx;
+}
+
/* Return true if BB has any active insns. */
static bool
bb_active_p (basic_block bb)
@@ -6062,7 +6076,7 @@ thread_prologue_and_epilogue_insns (void)
emit_return_into_block (false, last_bb);
epilogue_end = BB_END (last_bb);
if (JUMP_P (epilogue_end))
- JUMP_LABEL (epilogue_end) = ret_rtx;
+ set_return_jump_label (epilogue_end);
single_succ_edge (last_bb)->flags &= ~EDGE_FALLTHRU;
goto epilogue_done;
}
@@ -6127,15 +6141,7 @@ thread_prologue_and_epilogue_insns (void)
inserted = true;
if (JUMP_P (returnjump))
- {
- rtx pat = PATTERN (returnjump);
- if (GET_CODE (pat) == PARALLEL)
- pat = XVECEXP (pat, 0, 0);
- if (ANY_RETURN_P (pat))
- JUMP_LABEL (returnjump) = pat;
- else
- JUMP_LABEL (returnjump) = ret_rtx;
- }
+ set_return_jump_label (returnjump);
}
else
#endif
diff --git a/gcc/jump.c b/gcc/jump.c
index 0273adf..f852f82 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1086,6 +1086,7 @@ mark_jump_label_1 (rtx x, rtx insn, bool in_mem, bool is_target)
return;
case RETURN:
+ case SIMPLE_RETURN:
if (is_target)
{
gcc_assert (JUMP_LABEL (insn) == NULL || JUMP_LABEL (insn) == x);
@@ -1408,7 +1409,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rtx nlabel, rtx insn)
int i;
const char *fmt;
- if ((code == LABEL_REF && XEXP (x, 0) == olabel)
+ if ((code == LABEL_REF && XEXP (x, 0) == olabel)
|| x == olabel)
{
x = redirect_target (nlabel);
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 179bf5fb..f77a3a0 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -467,7 +467,7 @@ find_end_label (rtx kind)
/* The return we make may have delay slots too. */
rtx insn = gen_return ();
insn = emit_jump_insn (insn);
- JUMP_LABEL (insn) = ret_rtx;
+ set_return_jump_label (insn);
emit_barrier ();
if (num_delay_slots (insn) > 0)
obstack_ptr_grow (&unfilled_slots_obstack, insn);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 567aff9..f13485e 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2503,6 +2503,7 @@ extern int sibcall_epilogue_contains (const_rtx);
extern void mark_temp_addr_taken (rtx);
extern void update_temp_slot_address (rtx, rtx);
extern void maybe_copy_prologue_epilogue_insn (rtx, rtx);
+extern void set_return_jump_label (rtx);
/* In stmt.c */
extern void expand_null_return (void);