OSDN Git Service

gcc/ChangeLog:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 13 Dec 2010 03:08:06 +0000 (03:08 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 13 Dec 2010 03:08:06 +0000 (03:08 +0000)
PR debug/46782
* cfgcleanup.c (try_forward_edges): Skip debug insns.
gcc/testsuite/ChangeLog:
PR debug/46782
* gcc.dg/debug/pr46782.c: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167737 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cfgcleanup.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/debug/pr46782.c [new file with mode: 0644]

index 73329a8..92397f1 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-13  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR debug/46782
+       * cfgcleanup.c (try_forward_edges): Skip debug insns.
+
 2010-12-12  Jan Hubicka  <jh@suse.cz>
            Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
index c365b5e..78635d2 100644 (file)
@@ -487,11 +487,17 @@ try_forward_edges (int mode, basic_block b)
                    new_target = NULL;
                  else
                    {
+                     rtx last;
+
                      if (new_locus)
                        locus = new_locus;
 
-                     new_locus = INSN_P (BB_END (target))
-                                 ? INSN_LOCATOR (BB_END (target)) : 0;
+                     last = BB_END (target);
+                     if (DEBUG_INSN_P (last))
+                       last = prev_nondebug_insn (last);
+
+                     new_locus = last && INSN_P (last)
+                                 ? INSN_LOCATOR (last) : 0;
 
                      if (new_locus && locus && !locator_eq (new_locus, locus))
                        new_target = NULL;
index 5cf2c03..05a4341 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-13  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR debug/46782
+       * gcc.dg/debug/pr46782.c: New.
+
 2010-12-12  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/46809
diff --git a/gcc/testsuite/gcc.dg/debug/pr46782.c b/gcc/testsuite/gcc.dg/debug/pr46782.c
new file mode 100644 (file)
index 0000000..1603b09
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR debug/46782 */
+/* { dg-do compile } */
+/* { dg-options "-w -O0 -fvar-tracking -fcompare-debug" } */
+
+void foo (int i)
+{
+  if (i)
+    i++;
+  while (i)
+    ;
+}