]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR debug/46782 (-fcompare-debug failure (length) with -fvar-tracking)
authorAlexandre Oliva <aoliva@redhat.com>
Mon, 13 Dec 2010 03:08:06 +0000 (03:08 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Mon, 13 Dec 2010 03:08:06 +0000 (03:08 +0000)
gcc/ChangeLog:
PR debug/46782
* cfgcleanup.c (try_forward_edges): Skip debug insns.
gcc/testsuite/ChangeLog:
PR debug/46782
* gcc.dg/debug/pr46782.c: New.

From-SVN: r167737

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

index 73329a8c3abcd9a387204f12e9e2c12e367c4d2b..92397f12d877d8fb9244be9667ccbd8ddcb04d5d 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 c365b5e8a2dff30aadf916401703a8954ac570ae..78635d23a55fca44e3e52ea82c4a8c8835872131 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 5cf2c03fdeef6ab41376c7e15a540fa715ee1a8f..05a4341344399f1b7456f892d68841c944c73063 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)
+    ;
+}