diff mbox

config/bfin/bfin.c (hwloop_optimize): Set JUMP_LABEL() after emit jump_insn

Message ID 558A313B.2020505@redhat.com
State New
Headers show

Commit Message

Jeff Law June 24, 2015, 4:25 a.m. UTC
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.5i5j@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

Comments

Chen Gang June 24, 2015, 8:55 p.m. UTC | #1
On 6/24/15 12:25, Jeff Law wrote:
> 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.5i5j@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.
> 

OK, thanks. I shall continue to try another bfin bugs (which I found
during building Linux kernel with allmodconfig). I shall try to finish
one bug within this month (2015-06-30).

After finish bfin bugs (may be several bugs left, now), I shall try
tilegx testsuite with qemu (I almost finish qemu tilegx linux-user with
much help by qemu members). I shall try to start within next month.

And sorry for my disappearing several months:

 - I had to spend more time resources on qemu tilegx (for qemu tilegx, I
   had already delayed too much to bear).

 - I am not quite familiar with gcc internal contents, so if I do not
   spend enough time resources on an issue, I will probably send spams (
   may be even worse: hiding the issues instead of solving it).


Thanks.
diff mbox

Patch

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.5i5j@gmail.com>
+
+	PR target/65803
+	* config/bfin/bfin.c (hwloop_optimize): Initialize
+	JUMP_LABEL for newly created jump.
+
 2015-06-23  Tristan Gingold  <gingold@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.5i5j@gmail.com>
+
+        PR target/65803
+	* gcc.c-torture/pr65803.c: New test.
+
 2015-06-23  Patrick Palka  <ppalka@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++;
+    }
+}