aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2016-04-28 18:50:41 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2016-04-28 18:50:41 +0200
commit9759608c8989c0609d79d6b600f54745588e57a8 (patch)
treeeeb22e444ded340a0d3c15c0a7b90afeb4625c5b
parente41ebdf1c8fa94e1bb724a939d014b5f515496f0 (diff)
downloadgcc-9759608c8989c0609d79d6b600f54745588e57a8.zip
gcc-9759608c8989c0609d79d6b600f54745588e57a8.tar.gz
gcc-9759608c8989c0609d79d6b600f54745588e57a8.tar.bz2
nds32: Fix casesi (PR70668)
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. PR target/70668 * config/nds32/nds32.md (casesi): Don't access the operands array out of bounds. From-SVN: r235583
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/nds32/nds32.md8
2 files changed, 9 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3defcd2..c3a9c5e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2016-04-28 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (zeroing peephole2): Use general_reg_operand.
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 @@ create_template:
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;
})