From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95437 invoked by alias); 28 Apr 2016 15:46:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 94730 invoked by uid 89); 28 Apr 2016 15:46:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1212 X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 28 Apr 2016 15:46:13 +0000 Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id B6FB31C0441; Thu, 28 Apr 2016 15:46:10 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: jasonwucj@gmail.com, shiva0217@gmail.com, Segher Boessenkool Subject: [PATCH] nds32: Fix casesi (PR70668) Date: Thu, 28 Apr 2016 15:46:00 -0000 Message-Id: <21f11c9d07b31a70a5372333865564073fb68519.1461857901.git.segher@kernel.crashing.org> X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg01857.txt.bz2 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 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