Patchwork committed: Fix dbr processing of conditional returns

login
register
mail settings
Submitter Joern Rennecke
Date Nov. 5, 2012, 5:24 p.m.
Message ID <20121105122455.rm9ym73yasw888go-nzlynne@webmail.spamcop.net>
Download mbox | patch
Permalink /patch/197226/
State New
Headers show

Comments

Joern Rennecke - Nov. 5, 2012, 5:24 p.m.
fill_simple_delay_slots would call optimize_skip with a conditional return,
which would cause a segfault when it calls next_active_insn (RETURN).

Other places in reorg.c check that they are not operating on a return insn
before doing branch-insn only processing, so I added this check there too.

Bootstrapped on i686-pc-linux-gnu.

Committed as obviuous.
2012-11-05  Joern Rennecke  <joern.rennecke@embecosm.com>

	* reorg.c (fill_simple_delay_slots): Avoid calling optimize_skip
	with a return instruction.

Patch

Index: reorg.c
===================================================================
--- reorg.c	(revision 2686)
+++ reorg.c	(revision 2687)
@@ -2196,7 +2196,8 @@  fill_simple_delay_slots (int non_jumps_p
       if (slots_filled != slots_to_fill
 	  && delay_list == 0
 	  && JUMP_P (insn)
-	  && (condjump_p (insn) || condjump_in_parallel_p (insn)))
+	  && (condjump_p (insn) || condjump_in_parallel_p (insn))
+	  && !ANY_RETURN_P (JUMP_LABEL (insn)))
 	{
 	  delay_list = optimize_skip (insn);
 	  if (delay_list)