From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25667 invoked by alias); 25 Sep 2018 05:16:10 -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 25478 invoked by uid 89); 25 Sep 2018 05:15:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS,TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy= X-HELO: mail-wr1-f68.google.com Received: from mail-wr1-f68.google.com (HELO mail-wr1-f68.google.com) (209.85.221.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Sep 2018 05:15:24 +0000 Received: by mail-wr1-f68.google.com with SMTP id z3-v6so9998717wrr.13 for ; Mon, 24 Sep 2018 22:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:mail-followup-to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=xc8h9jN2OYN1RxLlpfp+a92qTxSW9bAO4SPmWR641j4=; b=klcpMJqk5aEqugcaFEZtk4FD3ZGC11/hHRHeLR8kxpoDnE+GJOPzlXNrqothApMKyb hL4Pbc+mFuBtjJCsLtpazYv822P03qQWjZwJ95956gTdaVgY3zdX6/bQbPZNz+8whuMS AObufvEJDwmQd0LMm7xJEMegQYDd/RwdEfS+85UKEsy+BF6PlQl2MjYHjhiSDpUxf9/h NexpDHU5G3WlTK4ZVRYJ+Te4qYcYCDWcmeDKuMRitiDXEkxJB2TK6+kL5bRLfY6cX5Ua alh0c7uDmzDQj1mXLs6vYk8wjDdl7w+9WfZQgJppv8SqC0+smiRKYRB1JT648t6ZesAl w8cQ== Return-Path: Received: from localhost (207.69.7.51.dyn.plus.net. [51.7.69.207]) by smtp.googlemail.com with ESMTPSA id e7-v6sm1455704wrs.25.2018.09.24.22.15.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Sep 2018 22:15:21 -0700 (PDT) From: Richard Sandiford To: Ilya Leoshkevich Mail-Followup-To: Ilya Leoshkevich ,gcc-patches@gcc.gnu.org, krebbel@linux.ibm.com, rdapp@linux.ibm.com, ro@CeBiTec.Uni-Bielefeld.DE, rdsandiford@googlemail.com Cc: gcc-patches@gcc.gnu.org, krebbel@linux.ibm.com, rdapp@linux.ibm.com, ro@CeBiTec.Uni-Bielefeld.DE Subject: Re: [PATCH] Fix EQ_ATTR_ALT size calculation (PR bootstrap/87417) References: <20180924214916.12356-1-iii@linux.ibm.com> Date: Tue, 25 Sep 2018 06:44:00 -0000 In-Reply-To: <20180924214916.12356-1-iii@linux.ibm.com> (Ilya Leoshkevich's message of "Mon, 24 Sep 2018 23:49:16 +0200") Message-ID: <874lee17l7.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2018-09/txt/msg01393.txt.bz2 Ilya Leoshkevich writes: > Bootstrap and regtest running on s390x-redhat-linux. > > "r264537: Change EQ_ATTR_ALT to support up to 64 alternatives" changed > the format of EQ_ATTR_ALT from ii to ww. This broke the bootstrap on > 32-bit systems, because the formula for rtx_code_size assumed that only > certain codes contain HOST_WIDE_INTs. This did not surface on 64-bit > systems, because rtunion is 8 bytes anyway, but on 32-bit systems it's > only 4 bytes. This resulted in out-of-bounds writes and memory > corruptions in genattrtab. > > gcc/ChangeLog: > > 2018-09-24 Ilya Leoshkevich > > PR bootstrap/87417 > * rtl.c (rtx_code_size): Take into account that EQ_ATTR_ALT > contains HOST_WIDE_INTs when computing its size. OK. Thanks for the quick fix. Richard > --- > gcc/rtl.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/gcc/rtl.c b/gcc/rtl.c > index f9146afcf2c..ca5c25c422f 100644 > --- a/gcc/rtl.c > +++ b/gcc/rtl.c > @@ -110,8 +110,7 @@ const enum rtx_class rtx_class[NUM_RTX_CODE] = { > > const unsigned char rtx_code_size[NUM_RTX_CODE] = { > #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) \ > - (((ENUM) == CONST_INT || (ENUM) == CONST_DOUBLE \ > - || (ENUM) == CONST_FIXED || (ENUM) == CONST_WIDE_INT) \ > + ((FORMAT)[0] == 'w' \ > ? RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (HOST_WIDE_INT) \ > : (ENUM) == REG \ > ? RTX_HDR_SIZE + sizeof (reg_info) \