Patchwork [PR,debug/45531] skip debug insns in cfglayout:fixup_reorder_chain

login
register
mail settings
Submitter Alexandre Oliva
Date Sept. 5, 2010, 1:06 p.m.
Message ID <orpqwsqr0c.fsf@livre.localdomain>
Download mbox | patch
Permalink /patch/63827/
State New
Headers show

Comments

Alexandre Oliva - Sept. 5, 2010, 1:06 p.m.
We don't hit this very often because debug insns aren't emitted without
optimization unless explicitly requested, and with optimization this
seems not to arise.  Anyhow, it's easy enough to fix the code so that,
even if it arises, we don't misbehave.

Regstrapping on x86_64-linux-gnu.  Ok to install?
Eric Botcazou - Sept. 7, 2010, 6:01 a.m.
> We don't hit this very often because debug insns aren't emitted without
> optimization unless explicitly requested, and with optimization this
> seems not to arise.  Anyhow, it's easy enough to fix the code so that,
> even if it arises, we don't misbehave.

This block of code is conditionalized on !optimize.

> Regstrapping on x86_64-linux-gnu.  Ok to install?

OK, thanks.

Patch

for  gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/45531
	* cfglayout.c (fixup_reorder_chain): Skip debug insns.

Index: gcc/cfglayout.c
===================================================================
--- gcc/cfglayout.c.orig	2010-09-05 09:42:08.000000000 -0300
+++ gcc/cfglayout.c	2010-09-05 09:46:10.000000000 -0300
@@ -955,7 +955,7 @@  fixup_reorder_chain (void)
 	      insn = BB_END (e->src);
 	      end = PREV_INSN (BB_HEAD (e->src));
 	      while (insn != end
-		     && (!INSN_P (insn) || INSN_LOCATOR (insn) == 0))
+		     && (!NONDEBUG_INSN_P (insn) || INSN_LOCATOR (insn) == 0))
 		insn = PREV_INSN (insn);
 	      if (insn != end
 		  && locator_eq (INSN_LOCATOR (insn), (int) e->goto_locus))
@@ -970,7 +970,7 @@  fixup_reorder_chain (void)
 		{
 		  insn = BB_HEAD (e->dest);
 		  end = NEXT_INSN (BB_END (e->dest));
-		  while (insn != end && !INSN_P (insn))
+		  while (insn != end && !NONDEBUG_INSN_P (insn))
 		    insn = NEXT_INSN (insn);
 		  if (insn != end && INSN_LOCATOR (insn)
 		      && locator_eq (INSN_LOCATOR (insn), (int) e->goto_locus))