aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-07-28 19:01:05 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-07-28 19:01:05 +0200
commit05b5ea3495029f4da3687c03a27d70dad682f585 (patch)
tree6e2e2c933c124f3e6df48df8ceee73af9f76ee8b /gcc
parent652c4638a0194d601e968599e27319e1edcd93e2 (diff)
downloadgcc-05b5ea3495029f4da3687c03a27d70dad682f585.zip
gcc-05b5ea3495029f4da3687c03a27d70dad682f585.tar.gz
gcc-05b5ea3495029f4da3687c03a27d70dad682f585.tar.bz2
re PR debug/45105 (-fcompare-debug failure at -Os)
PR debug/45105 * gcse.c (hoist_code): Use FOR_BB_INSNS macro. * gcc.dg/pr45105.c: New test. From-SVN: r162647
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/gcse.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr45105.c27
4 files changed, 36 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 03c0db1..a4491cb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
2010-07-28 Jakub Jelinek <jakub@redhat.com>
+ PR debug/45105
+ * gcse.c (hoist_code): Use FOR_BB_INSNS macro.
+
PR debug/45103
* dwarf2out.c (dwarf2out_var_location): Always consider
NOTE_DURING_CALL_P notes, even when not followed by real instructions.
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 6e923f9..15809aa 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4390,21 +4390,15 @@ hoist_code (void)
FOR_EACH_BB (bb)
{
rtx insn;
- rtx bb_end;
int to_head;
- insn = BB_HEAD (bb);
- bb_end = BB_END (bb);
to_head = 0;
-
- while (insn != bb_end)
+ FOR_BB_INSNS (bb, insn)
{
/* Don't count debug instructions to avoid them affecting
decision choices. */
if (NONDEBUG_INSN_P (insn))
to_bb_head[INSN_UID (insn)] = to_head++;
-
- insn = NEXT_INSN (insn);
}
bb_size[bb->index] = to_head;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3dbe028..cd97c64 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/45105
+ * gcc.dg/pr45105.c: New test.
+
2010-07-28 Maxim Kuvyrkov <maxim@codesourcery.com>
PR rtl-optimization/45107
diff --git a/gcc/testsuite/gcc.dg/pr45105.c b/gcc/testsuite/gcc.dg/pr45105.c
new file mode 100644
index 0000000..a93a21f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr45105.c
@@ -0,0 +1,27 @@
+/* PR debug/45105 */
+/* { dg-do compile } */
+/* { dg-options "-Os -fcompare-debug" } */
+
+extern int *baz (int *, int *);
+
+void
+bar (int *p1, int *p2)
+{
+ int n = *baz (0, 0);
+ p1[n] = p2[n];
+}
+
+void
+foo (int *p, int l)
+{
+ int a1[32];
+ int a2[32];
+ baz (a1, a2);
+ while (l)
+ {
+ if (l & 1)
+ p = baz (a2, p);
+ l--;
+ bar (a1, a2);
+ }
+}