* [PATCH][4.9/5 Backport] PR rtl-optimization/67037 Use copy_rtx when necessary
@ 2015-10-28 23:19 Grazvydas Ignotas
2015-11-04 10:49 ` Grazvydas Ignotas
0 siblings, 1 reply; 2+ messages in thread
From: Grazvydas Ignotas @ 2015-10-28 23:19 UTC (permalink / raw)
To: gcc-patches; +Cc: Bernd Edlinger, Grazvydas Ignotas
Hi,
This is the 4.9 and GCC 5 backport of patch from PR67037 that's already in trunk.
I've build it on 4.9 and confirmed that it works.
Grazvydas
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-09-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR rtl-optimization/67037
* gcc.c-torture/execute/pr67037.c: New test.
---
gcc/lra-constraints.c | 2 +-
gcc/testsuite/gcc.c-torture/execute/pr67037.c | 49 +++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr67037.c
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index ae8f3cd..919b127 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -1203,7 +1203,7 @@ process_addr_reg (rtx *loc, rtx *before, rtx *after, enum reg_class cl)
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 ();
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr67037.c b/gcc/testsuite/gcc.c-torture/execute/pr67037.c
new file mode 100644
index 0000000..3119d32
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr67037.c
@@ -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);
+}
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][4.9/5 Backport] PR rtl-optimization/67037 Use copy_rtx when necessary
2015-10-28 23:19 [PATCH][4.9/5 Backport] PR rtl-optimization/67037 Use copy_rtx when necessary Grazvydas Ignotas
@ 2015-11-04 10:49 ` Grazvydas Ignotas
0 siblings, 0 replies; 2+ messages in thread
From: Grazvydas Ignotas @ 2015-11-04 10:49 UTC (permalink / raw)
To: gcc-patches; +Cc: Bernd Edlinger, Grazvydas Ignotas
Can anyone commit this, please?
On Thu, Oct 29, 2015 at 12:48 AM, Grazvydas Ignotas <notasas@gmail.com> wrote:
> Hi,
>
> This is the 4.9 and GCC 5 backport of patch from PR67037 that's already in trunk.
> I've build it on 4.9 and confirmed that it works.
>
> Grazvydas
>
> 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-09-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
>
> PR rtl-optimization/67037
> * gcc.c-torture/execute/pr67037.c: New test.
> ---
> gcc/lra-constraints.c | 2 +-
> gcc/testsuite/gcc.c-torture/execute/pr67037.c | 49 +++++++++++++++++++++++++++
> 2 files changed, 50 insertions(+), 1 deletion(-)
> create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr67037.c
>
> diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
> index ae8f3cd..919b127 100644
> --- a/gcc/lra-constraints.c
> +++ b/gcc/lra-constraints.c
> @@ -1203,7 +1203,7 @@ process_addr_reg (rtx *loc, rtx *before, rtx *after, enum reg_class cl)
> 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 ();
> diff --git a/gcc/testsuite/gcc.c-torture/execute/pr67037.c b/gcc/testsuite/gcc.c-torture/execute/pr67037.c
> new file mode 100644
> index 0000000..3119d32
> --- /dev/null
> +++ b/gcc/testsuite/gcc.c-torture/execute/pr67037.c
> @@ -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);
> +}
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-04 10:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-28 23:19 [PATCH][4.9/5 Backport] PR rtl-optimization/67037 Use copy_rtx when necessary Grazvydas Ignotas
2015-11-04 10:49 ` Grazvydas Ignotas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).