public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix target/100106 ICE in gen_movdi
@ 2021-04-22  6:37 Bernd Edlinger
  2021-04-22  6:38 ` Bernd Edlinger
  0 siblings, 1 reply; 3+ messages in thread
From: Bernd Edlinger @ 2021-04-22  6:37 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Biener

As the test case shows, the outer mode may have a higher alignment
requirement than the inner mode here.

2021-04-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR target/100106
	* gimplify-rtx.c (simplify_context::simplify_subreg): Check the
	memory alignment for the outer mode.

	* gcc.c-torture/compile/pr100106.c: New testcase.
---
 gcc/simplify-rtx.c                             |  1 +
 gcc/testsuite/gcc.c-torture/compile/pr100106.c | 11 +++++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr100106.c

diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index d13c390..ad3b7b2 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -7217,6 +7217,7 @@ simplify_context::simplify_subreg (machine_mode outermode, rtx op,
          have instruction to move the whole thing.  */
       && (! MEM_VOLATILE_P (op)
 	  || ! have_insn_for (SET, innermode))
+      && !(STRICT_ALIGNMENT && MEM_ALIGN (op) < GET_MODE_ALIGNMENT (outermode))
       && known_le (outersize, innersize))
     return adjust_address_nv (op, outermode, byte);
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100106.c b/gcc/testsuite/gcc.c-torture/compile/pr100106.c
new file mode 100644
index 0000000..7f98b4f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr100106.c
@@ -0,0 +1,11 @@
+union a {
+  float _Complex b;
+  long long c;
+};
+
+void g(union a);
+
+void e() {
+  union a f = {1.0f};
+  g(f);
+}
-- 
1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix target/100106 ICE in gen_movdi
  2021-04-22  6:37 [PATCH] Fix target/100106 ICE in gen_movdi Bernd Edlinger
@ 2021-04-22  6:38 ` Bernd Edlinger
  2021-04-22  6:44   ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Bernd Edlinger @ 2021-04-22  6:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Biener

Aehm,

forgot to mention,

tested on arm-none-eabi (arm-sim target)
is it OK for trunk?


Thanks
Bernd.

On 4/22/21 8:37 AM, Bernd Edlinger wrote:
> As the test case shows, the outer mode may have a higher alignment
> requirement than the inner mode here.
> 
> 2021-04-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>
> 
> 	PR target/100106
> 	* gimplify-rtx.c (simplify_context::simplify_subreg): Check the
> 	memory alignment for the outer mode.
> 
> 	* gcc.c-torture/compile/pr100106.c: New testcase.
> ---
>  gcc/simplify-rtx.c                             |  1 +
>  gcc/testsuite/gcc.c-torture/compile/pr100106.c | 11 +++++++++++
>  2 files changed, 12 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr100106.c
> 
> diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
> index d13c390..ad3b7b2 100644
> --- a/gcc/simplify-rtx.c
> +++ b/gcc/simplify-rtx.c
> @@ -7217,6 +7217,7 @@ simplify_context::simplify_subreg (machine_mode outermode, rtx op,
>           have instruction to move the whole thing.  */
>        && (! MEM_VOLATILE_P (op)
>  	  || ! have_insn_for (SET, innermode))
> +      && !(STRICT_ALIGNMENT && MEM_ALIGN (op) < GET_MODE_ALIGNMENT (outermode))
>        && known_le (outersize, innersize))
>      return adjust_address_nv (op, outermode, byte);
>  
> diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100106.c b/gcc/testsuite/gcc.c-torture/compile/pr100106.c
> new file mode 100644
> index 0000000..7f98b4f
> --- /dev/null
> +++ b/gcc/testsuite/gcc.c-torture/compile/pr100106.c
> @@ -0,0 +1,11 @@
> +union a {
> +  float _Complex b;
> +  long long c;
> +};
> +
> +void g(union a);
> +
> +void e() {
> +  union a f = {1.0f};
> +  g(f);
> +}
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix target/100106 ICE in gen_movdi
  2021-04-22  6:38 ` Bernd Edlinger
@ 2021-04-22  6:44   ` Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2021-04-22  6:44 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: gcc-patches

On Thu, 22 Apr 2021, Bernd Edlinger wrote:

> Aehm,
> 
> forgot to mention,
> 
> tested on arm-none-eabi (arm-sim target)
> is it OK for trunk?

OK next week (when RC2 looks good).

Thanks,
Richard.

> 
> Thanks
> Bernd.
> 
> On 4/22/21 8:37 AM, Bernd Edlinger wrote:
> > As the test case shows, the outer mode may have a higher alignment
> > requirement than the inner mode here.
> > 
> > 2021-04-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>
> > 
> > 	PR target/100106
> > 	* gimplify-rtx.c (simplify_context::simplify_subreg): Check the
> > 	memory alignment for the outer mode.
> > 
> > 	* gcc.c-torture/compile/pr100106.c: New testcase.
> > ---
> >  gcc/simplify-rtx.c                             |  1 +
> >  gcc/testsuite/gcc.c-torture/compile/pr100106.c | 11 +++++++++++
> >  2 files changed, 12 insertions(+)
> >  create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr100106.c
> > 
> > diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
> > index d13c390..ad3b7b2 100644
> > --- a/gcc/simplify-rtx.c
> > +++ b/gcc/simplify-rtx.c
> > @@ -7217,6 +7217,7 @@ simplify_context::simplify_subreg (machine_mode outermode, rtx op,
> >           have instruction to move the whole thing.  */
> >        && (! MEM_VOLATILE_P (op)
> >  	  || ! have_insn_for (SET, innermode))
> > +      && !(STRICT_ALIGNMENT && MEM_ALIGN (op) < GET_MODE_ALIGNMENT (outermode))
> >        && known_le (outersize, innersize))
> >      return adjust_address_nv (op, outermode, byte);
> >  
> > diff --git a/gcc/testsuite/gcc.c-torture/compile/pr100106.c b/gcc/testsuite/gcc.c-torture/compile/pr100106.c
> > new file mode 100644
> > index 0000000..7f98b4f
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.c-torture/compile/pr100106.c
> > @@ -0,0 +1,11 @@
> > +union a {
> > +  float _Complex b;
> > +  long long c;
> > +};
> > +
> > +void g(union a);
> > +
> > +void e() {
> > +  union a f = {1.0f};
> > +  g(f);
> > +}
> > 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-22  6:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22  6:37 [PATCH] Fix target/100106 ICE in gen_movdi Bernd Edlinger
2021-04-22  6:38 ` Bernd Edlinger
2021-04-22  6:44   ` Richard Biener

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).