On 06/20/2015 04:48 AM, Chen Gang wrote:
JUMP_LABLE() must be defined after optimization completed. In this case,
it is doing optimization, and is almost finished, so it is no chances to
set JUMP_LABLE() next. The related issue is Bug 65803.
2015-06-20 Chen Gang <gang.chen.5...@gmail.com>
* config/bfin/bfin.c (hwloop_optimize): Set JUMP_LABEL() after
emit jump_insn.
Thanks. I've reduced the testcase from pr65803 and committed the
changes to the trunk along with the reduced testcase.
I tested the bfin port lightly -- just confirmed that it'd build newlib
as a sanity test.
Actual committed patch is attached for archival purposes.
jeff
commit d92f6ac8fe29fbbeffb644128fea3ae979f990c3
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed Jun 24 04:22:39 2015 +0000
PR target/65803
* config/bfin/bfin.c (hwloop_optimize): Initialize
JUMP_LABEL for newly created jump.
PR target/65803
* gcc.c-torture/pr65803.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224866
138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ab34ffc..cbd8d88 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-06-23 Chen Gang <gang.chen.5...@gmail.com>
+
+ PR target/65803
+ * config/bfin/bfin.c (hwloop_optimize): Initialize
+ JUMP_LABEL for newly created jump.
+
2015-06-23 Tristan Gingold <ging...@adacore.com>
* collect-utils.c (collect_wait): Unlink the response file here
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 3b4b54e..594272f 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3775,7 +3775,9 @@ hwloop_optimize (hwloop_info loop)
}
else
{
- emit_jump_insn (gen_jump (label));
+ rtx_insn *ret = emit_jump_insn (gen_jump (label));
+ JUMP_LABEL (ret) = label;
+ LABEL_NUSES (label)++;
seq_end = emit_barrier ();
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e95ed37..5fe00e1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-23 Chen Gang <gang.chen.5...@gmail.com>
+
+ PR target/65803
+ * gcc.c-torture/pr65803.c: New test.
+
2015-06-23 Patrick Palka <ppa...@gcc.gnu.org>
PR c++/30044
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr65803.c
b/gcc/testsuite/gcc.c-torture/compile/pr65803.c
new file mode 100644
index 0000000..57c6676
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr65803.c
@@ -0,0 +1,25 @@
+/* { dg-options "-fno-strict-overflow" } */
+typedef unsigned char __uint8_t;
+typedef __uint8_t uint8_t;
+typedef uint8_t u8_t;
+typedef struct ip_addr ip_addr_t;
+char *
+ipaddr_ntoa_r (const ip_addr_t * addr, char *buf, int buflen)
+{
+ char inv[3];
+ char *rp;
+ u8_t *ap;
+ u8_t n;
+ u8_t i;
+ int len = 0;
+ for (n = 0; n < 4; n++)
+ {
+ while (*ap);
+ while (i--)
+ {
+ if (len++ >= buflen)
+ return ((void *) 0);
+ *rp++ = inv[i];
+ } ap++;
+ }
+}