public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] nds32: Fix casesi (PR70668)
@ 2016-04-28 15:46 Segher Boessenkool
  2016-04-28 15:59 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Segher Boessenkool @ 2016-04-28 15:46 UTC (permalink / raw)
  To: gcc-patches; +Cc: jasonwucj, shiva0217, Segher Boessenkool

Expanders do not have more elements in the operands array than declared
in the pattern.  So, we cannot use operands[5] here.  Instead just
declare and use another rtx.

Built with a cross compiler; not tested otherwise.  Is this okay for trunk?


Segher


2016-04-28  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/70668
	* config/nds32/nds32.md (casesi): Don't access the operands array
	out of bounds.

---
 gcc/config/nds32/nds32.md | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/gcc/config/nds32/nds32.md b/gcc/config/nds32/nds32.md
index 5cdd8b2..494a78d 100644
--- a/gcc/config/nds32/nds32.md
+++ b/gcc/config/nds32/nds32.md
@@ -2288,11 +2288,9 @@ (define_expand "casesi"
   emit_jump_insn (gen_cbranchsi4 (test, operands[0], operands[2],
 				  operands[4]));
 
-  operands[5] = gen_reg_rtx (SImode);
-  /* Step C, D, E, and F, using another temporary register operands[5].  */
-  emit_jump_insn (gen_casesi_internal (operands[0],
-				       operands[3],
-				       operands[5]));
+  /* Step C, D, E, and F, using another temporary register.  */
+  rtx tmp = gen_reg_rtx (SImode);
+  emit_jump_insn (gen_casesi_internal (operands[0], operands[3], tmp));
   DONE;
 })
 
-- 
1.9.3

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

* Re: [PATCH] nds32: Fix casesi (PR70668)
  2016-04-28 15:46 [PATCH] nds32: Fix casesi (PR70668) Segher Boessenkool
@ 2016-04-28 15:59 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2016-04-28 15:59 UTC (permalink / raw)
  To: Segher Boessenkool, gcc-patches; +Cc: jasonwucj, shiva0217

On 04/28/2016 09:45 AM, Segher Boessenkool wrote:
> Expanders do not have more elements in the operands array than declared
> in the pattern.  So, we cannot use operands[5] here.  Instead just
> declare and use another rtx.
>
> Built with a cross compiler; not tested otherwise.  Is this okay for trunk?
>
>
> Segher
>
>
> 2016-04-28  Segher Boessenkool  <segher@kernel.crashing.org>
>
> 	PR target/70668
> 	* config/nds32/nds32.md (casesi): Don't access the operands array
> 	out of bounds.
OK.
jeff

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

end of thread, other threads:[~2016-04-28 15:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-28 15:46 [PATCH] nds32: Fix casesi (PR70668) Segher Boessenkool
2016-04-28 15:59 ` Jeff Law

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