From 18275e190afe18f6c61179101d38ca603acb1a15 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Sat, 18 Dec 2010 06:24:52 +0000 Subject: [PATCH] re PR debug/46782 (-fcompare-debug failure (length) with -fvar-tracking) 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 | 5 +++++ gcc/cfgcleanup.c | 9 +++++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/debug/pr46782.c | 11 +++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/debug/pr46782.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0d70a33e23c8..4595f63fb8f7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-12-18 Alexandre Oliva + + PR debug/46782 + * cfgcleanup.c (try_forward_edges): Skip debug insns. + 2010-12-16 Eric Botcazou * tree-ssa-sccvn.c (vn_reference_lookup_3): Always punt if the call to diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 5b022f27eeb4..e63125aec541 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 95ba8aa5faf4..7687f98c1e5a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-12-18 Alexandre Oliva + + PR debug/46782 + * gcc.dg/debug/pr46782.c: New. + 2010-12-17 Daniel Kraft 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 index 000000000000..1603b0922c2c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr46782.c @@ -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) + ; +} -- 2.47.2