From patchwork Tue Jan 10 09:01:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chung-Ju Wu X-Patchwork-Id: 713180 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tyQy71Ykgz9sdn for ; Tue, 10 Jan 2017 20:02:06 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wN/IMDmK"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=g7WvX5ftj1OUK70CflIWVZDoMdatqiK/ro9O21PFQClx1KFOVG N844E43O4lDzG12gnxrokzj+swanOPOcS2iDKvYEjiXS5/6Mojiys4DS+ZM0zIrv 27IEbnzLDUxHdeVSv6vgYmRRzSwoU08/Jd10spHnDvNM4h5ht9wEysAQs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=NnckY0G2EhNnluiEiEGVTW0CUzE=; b=wN/IMDmKL3nZ/PITv7SF YwycF6AbFByWo58NR7lWjd9GPY1o4Dcx4DrDLYKVBxWVig27JtoYMS0Q2js0/kiY cGEMYYcUHk70x2ZAEEq71nMx9j35huYTR4nkZS0Wlbc5ASiKWMNHGmmZkrV3C2qZ Dd1Kmdk25UTHAdYH97WbW/E= Received: (qmail 107348 invoked by alias); 10 Jan 2017 09:01:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 107287 invoked by uid 89); 10 Jan 2017 09:01:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=stefan, Stefan X-HELO: mail-pf0-f196.google.com Received: from mail-pf0-f196.google.com (HELO mail-pf0-f196.google.com) (209.85.192.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Jan 2017 09:01:16 +0000 Received: by mail-pf0-f196.google.com with SMTP id y143so6924078pfb.1 for ; Tue, 10 Jan 2017 01:01:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version; bh=PexCtowJ9wjNLsNxJMCzS7D/xj55iE5NWz09Nf5Fh8A=; b=hWICNEge3JgWXHWVePoDaAusZx2+z00aBgbvwkZ3PNuJ+A9U54SYtx7p5ISkc6U5Kl WRpEpitDeufUyU8nRuztdKrRMSE2ED3+hBQhTPCpwXbW8m6yuqUnnPuomFcJ69TPOvZz ObhuRjtJjA5B3Jj9aDtsUItEv19boH1dfNzhj7kKd8OkVSaELJ9UUdiBsPXV7irxNrMC Nd3k1IS0VzmmfpG38HM2lq3jOVzvUq1Zb8tcAt6ef4oRDwtnW9XdYcixEgn4aYRKkFIM pRlUUB3YNL6LMb0qrsXR/unoKtvewx/SxA9fDLKNQpxHpNy6evEuNIT1weznysQ+iAXE uORg== X-Gm-Message-State: AIkVDXKlnb5bufNnRoSgeR1a0Ik/vyiAfSvxfeknSVi2ufYV93U9+fsrhwqOEgTdFndiRA== X-Received: by 10.84.195.228 with SMTP id j91mr3314260pld.88.1484038875250; Tue, 10 Jan 2017 01:01:15 -0800 (PST) Received: from jasonwucj-macbook.local (111-248-81-77.dynamic.hinet.net. [111.248.81.77]) by smtp.gmail.com with ESMTPSA id o68sm3556153pfb.42.2017.01.10.01.01.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jan 2017 01:01:13 -0800 (PST) To: stefan.reinauer@coreboot.org, segher@kernel.crashing.org, gcc-patches@gcc.gnu.org Cc: shiva0217@gmail.com From: Chung-Ju Wu Subject: [PATCH] nds32: Backport PR70668 solution from mainline Message-ID: <0c32ee11-c27f-9558-72f8-fbd1f25f705d@gmail.com> Date: Tue, 10 Jan 2017 17:01:10 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, all, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70668 https://gcc.gnu.org/ml/gcc-patches/2016-04/msg01862.html Thanks Stefan Reinauer to create this PR and thanks Segher Boessenkool to fix the issue. Now I backport the solution to gcc-6 and gcc-5 branches. Committed as revision r244257 and r244258. https://gcc.gnu.org/r244257 https://gcc.gnu.org/r244258 Best regards, jasonwucj Index: gcc/ChangeLog =================================================================== --- gcc/ChangeLog (revision 244256) +++ gcc/ChangeLog (working copy) @@ -1,3 +1,12 @@ +2017-01-10 Chung-Ju Wu + + Backport from mainline + 2016-04-28 Segher Boessenkool + + PR target/70668 + * config/nds32/nds32.md (casesi): Don't access the operands array + out of bounds. + 2017-01-09 Andreas Tobler Backport from mainline Index: gcc/config/nds32/nds32.md =================================================================== --- gcc/config/nds32/nds32.md (revision 244256) +++ gcc/config/nds32/nds32.md (working copy) @@ -2288,11 +2288,9 @@ 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; }) Index: gcc/ChangeLog =================================================================== --- gcc/ChangeLog (revision 244256) +++ gcc/ChangeLog (working copy) @@ -1,3 +1,12 @@ +2017-01-10 Chung-Ju Wu + + Backport from mainline + 2016-04-28 Segher Boessenkool + + PR target/70668 + * config/nds32/nds32.md (casesi): Don't access the operands array + out of bounds. + 2017-01-09 Andreas Tobler Backport from mainline Index: gcc/config/nds32/nds32.md =================================================================== --- gcc/config/nds32/nds32.md (revision 244256) +++ gcc/config/nds32/nds32.md (working copy) @@ -2289,11 +2289,9 @@ 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; })