aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-12-01 17:57:07 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2011-12-01 17:57:07 +0100
commit0397b9654739300f9a1e8a76c8cc816d3cb83bc7 (patch)
tree2a0b61e7b0f5bbfe78e39830f2ed9679d4bb4e5c
parentc8218030cc41f25713093f2604d784a781097a11 (diff)
downloadgcc-0397b9654739300f9a1e8a76c8cc816d3cb83bc7.zip
gcc-0397b9654739300f9a1e8a76c8cc816d3cb83bc7.tar.gz
gcc-0397b9654739300f9a1e8a76c8cc816d3cb83bc7.tar.bz2
re PR rtl-optimization/51014 (ICE: in apply_opt_in_copies, at loop-unroll.c:2283 with -O2 -g -funroll-loops)
PR rtl-optimization/51014 * loop-unroll.c (apply_opt_in_copies): Ignore label DEBUG_INSNs both from bb and orig_bb. * g++.dg/opt/pr51014.C: New test. From-SVN: r181883
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/loop-unroll.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/opt/pr51014.C16
4 files changed, 35 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1020e90..6a9c965 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-12-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/51014
+ * loop-unroll.c (apply_opt_in_copies): Ignore label DEBUG_INSNs
+ both from bb and orig_bb.
+
2011-12-01 Joern Rennecke <joern.rennecke@embecosm.com>
PR tree-optimization/50802
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 6deff41..378b933 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -1,5 +1,5 @@
/* Loop unrolling and peeling.
- Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2010
+ Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2010, 2011
Free Software Foundation, Inc.
This file is part of GCC.
@@ -2262,10 +2262,15 @@ apply_opt_in_copies (struct opt_info *opt_info,
for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); insn = next)
{
next = NEXT_INSN (insn);
- if (!INSN_P (insn))
+ if (!INSN_P (insn)
+ || (DEBUG_INSN_P (insn)
+ && TREE_CODE (INSN_VAR_LOCATION_DECL (insn)) == LABEL_DECL))
continue;
- while (!INSN_P (orig_insn))
+ while (!INSN_P (orig_insn)
+ || (DEBUG_INSN_P (orig_insn)
+ && (TREE_CODE (INSN_VAR_LOCATION_DECL (orig_insn))
+ == LABEL_DECL)))
orig_insn = NEXT_INSN (orig_insn);
ivts_templ.insn = orig_insn;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index db9afc1..acd23f9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/51014
+ * g++.dg/opt/pr51014.C: New test.
+
2011-12-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51367
diff --git a/gcc/testsuite/g++.dg/opt/pr51014.C b/gcc/testsuite/g++.dg/opt/pr51014.C
new file mode 100644
index 0000000..1e5bb9f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr51014.C
@@ -0,0 +1,16 @@
+// PR rtl-optimization/51014
+// { dg-do compile }
+// { dg-options "-O2 -funroll-loops -fcompare-debug" }
+
+struct S
+{
+ ~S() { delete s; }
+ int *s;
+};
+
+void
+f (S *x, S *y)
+{
+ for (; x != y; ++x)
+ x->~S();
+}