diff mbox

GCC-5 Backport of pr67037

Message ID HE1PR07MB090550853029E32286BF613CE4040@HE1PR07MB0905.eurprd07.prod.outlook.com
State New
Headers show

Commit Message

Bernd Edlinger Nov. 26, 2015, 9:55 a.m. UTC
Hi,

I have boot-strapped & reg-tested this patch now
on arm-linux-gnueabihf with all languages enabled.

Is it OK for the gcc-5-branch?


Thanks
Bernd.
gcc:
2015-11-26  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	Backport from mainline
	2015-09-30  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR rtl-optimization/67037    
	* lra-constraints.c (process_addr_reg): Use copy_rtx when necessary.

testsuite:
2015-11-26  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	Backport from mainline
	2015-09-30  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR rtl-optimization/67037
	* gcc.c-torture/execute/pr67037.c: New test.

Comments

Richard Biener Nov. 26, 2015, 9:57 a.m. UTC | #1
On Thu, 26 Nov 2015, Bernd Edlinger wrote:

> 
> Hi,
> 
> I have boot-strapped & reg-tested this patch now
> on arm-linux-gnueabihf with all languages enabled.
> 
> Is it OK for the gcc-5-branch?

Ok.

Thanks,
Richard.
diff mbox

Patch

--- gcc/lra-constraints.c.jj	2015-09-25 23:06:08.000000000 +0200
+++ gcc/lra-constraints.c	2015-09-29 13:29:01.695783261 +0200
@@ -1339,7 +1339,7 @@  process_addr_reg (rtx *loc, bool check_o
   if (after != NULL)
     {
       start_sequence ();
-      lra_emit_move (reg, new_reg);
+      lra_emit_move (before_p ? copy_rtx (reg) : reg, new_reg);
       emit_insn (*after);
       *after = get_insns ();
       end_sequence ();
--- /dev/null	2015-09-28 14:17:37.079363115 +0200
+++ gcc/testsuite/gcc.c-torture/execute/pr67037.c	2015-09-30 08:04:22.794285807 +0200
@@ -0,0 +1,49 @@ 
+long (*extfunc)();
+
+static inline void lstrcpynW( short *d, const short *s, int n )
+{
+    unsigned int count = n;
+
+    while ((count > 1) && *s)
+    {
+        count--;
+        *d++ = *s++;
+    }
+    if (count) *d = 0;
+}
+
+int __attribute__((noinline,noclone))
+badfunc(int u0, int u1, int u2, int u3,
+  short *fsname, unsigned int fsname_len)
+{
+    static const short ntfsW[] = {'N','T','F','S',0};
+    char superblock[2048+3300];
+    int ret = 0;
+    short *p;
+
+    if (extfunc())
+        return 0;
+    p = (void *)extfunc();
+    if (p != 0)
+        goto done;
+
+    extfunc(superblock);
+
+    lstrcpynW(fsname, ntfsW, fsname_len);
+
+    ret = 1;
+done:
+    return ret;
+}
+
+static long f()
+{
+    return 0;
+}
+
+int main()
+{
+    short buf[6];
+    extfunc = f;
+    return !badfunc(0, 0, 0, 0, buf, 6);
+}