]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR debug/46782 (-fcompare-debug failure (length) with -fvar-tracking)
authorAlexandre Oliva <aoliva@redhat.com>
Sat, 18 Dec 2010 06:24:52 +0000 (06:24 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Sat, 18 Dec 2010 06:24:52 +0000 (06:24 +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: r168013

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

index 0d70a33e23c88cd30b3c777848e196048591246b..4595f63fb8f754469892d783fe4700f3b1701258 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-18  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR debug/46782
+       * cfgcleanup.c (try_forward_edges): Skip debug insns.
+
 2010-12-16  Eric Botcazou  <ebotcazou@adacore.com>
 
        * tree-ssa-sccvn.c (vn_reference_lookup_3): Always punt if the call to
index 5b022f27eeb4d4003e4619251eba00e0c33ab23b..e63125aec541e0741ea68099334dae38409eb390 100644 (file)
@@ -482,15 +482,20 @@ try_forward_edges (int mode, basic_block b)
                  /* When not optimizing, ensure that edges or forwarder
                     blocks with different locus are not optimized out.  */
                  int locus = single_succ_edge (target)->goto_locus;
+                 rtx last ;
 
                  if (locus && goto_locus && !locator_eq (locus, goto_locus))
                    counter = n_basic_blocks;
                  else if (locus)
                    goto_locus = locus;
 
-                 if (INSN_P (BB_END (target)))
+                 last = BB_END (target);
+                 if (DEBUG_INSN_P (last))
+                   last = prev_nondebug_insn (last);
+
+                 if (last && INSN_P (last))
                    {
-                     locus = INSN_LOCATOR (BB_END (target));
+                     locus = INSN_LOCATOR (last);
 
                      if (locus && goto_locus
                          && !locator_eq (locus, goto_locus))
index 95ba8aa5faf40be70a8228ecc58fa5ef9f6e3ea3..7687f98c1e5ae60c15f2c213645472e39a6aa97b 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-18  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR debug/46782
+       * gcc.dg/debug/pr46782.c: New.
+
 2010-12-17  Daniel Kraft  <d@domob.eu>
 
        PR fortran/46794
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)
+    ;
+}