From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10058 invoked by alias); 25 Oct 2018 13:58:46 -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 10038 invoked by uid 89); 25 Oct 2018 13:58:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Oct 2018 13:58:44 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 469F7A78; Thu, 25 Oct 2018 06:58:43 -0700 (PDT) Received: from e120077-lin.cambridge.arm.com (e120077-lin.cambridge.arm.com [10.2.206.194]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 09AB93F6A8; Thu, 25 Oct 2018 06:58:41 -0700 (PDT) Subject: Re: [PATCH] Fix rtx_code_size static initialization order fiasco To: Ilya Leoshkevich , gcc-patches@gcc.gnu.org Cc: krebbel@linux.ibm.com, rdapp@linux.ibm.com, rsandifo@gcc.gnu.org, rguenther@suse.de References: <20181025132938.37913-1-iii@linux.ibm.com> From: "Richard Earnshaw (lists)" Openpgp: preference=signencrypt Message-ID: Date: Thu, 25 Oct 2018 14:27:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181025132938.37913-1-iii@linux.ibm.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2018-10/txt/msg01593.txt.bz2 On 25/10/2018 14:29, Ilya Leoshkevich wrote: > Bootstrapped and regtested on s390x-redhat-linux. > > r264556 and r264537 changed the format of EQ_ATTR_ALT RTXs to "ww", > which also required adjusting rtx_code_size initializer. In order to > simplify things, the list of rtx_codes known to use HOST_WIDE_INTs was > replaced by the format string check. However, unlike the old one, this > new check cannot be always performed at compile time, in which case a > static constructor is generated. This may lead to a static > initialization order fiasco with respect to other static constructors > in the compiler, in case of PR87747, cselib's pool_allocator. > > gcc/ChangeLog: > > 2018-10-25 Ilya Leoshkevich > > PR bootstrap/87747 > * rtl.c (RTX_CODE_HWINT_P_1): New helper macro. > (RTX_CODE_HWINT_P): New macro. > (rtx_code_size): Use RTX_CODE_HWINT_P (). > --- > gcc/rtl.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/gcc/rtl.c b/gcc/rtl.c > index ca5c25c422f..86a40b11cf4 100644 > --- a/gcc/rtl.c > +++ b/gcc/rtl.c > @@ -106,11 +106,23 @@ const enum rtx_class rtx_class[NUM_RTX_CODE] = { > #undef DEF_RTL_EXPR > }; > > +/* Whether rtxs with the given code code store data in the hwint field. */ > + > +#define RTX_CODE_HWINT_P_1(ENUM) \ > + ((ENUM) == CONST_INT || (ENUM) == CONST_DOUBLE \ > + || (ENUM) == CONST_FIXED || (ENUM) == CONST_WIDE_INT) > +#ifdef GENERATOR_FILE > +#define RTX_CODE_HWINT_P(ENUM) \ > + (RTX_CODE_HWINT_P_1 (ENUM) || (ENUM) == EQ_ATTR_ALT) > +#else > +#define RTX_CODE_HWINT_P RTX_CODE_HWINT_P_1 > +#endif > + > /* Indexed by rtx code, gives the size of the rtx in bytes. */ > > const unsigned char rtx_code_size[NUM_RTX_CODE] = { > #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) \ > - ((FORMAT)[0] == 'w' \ > + (RTX_CODE_HWINT_P (ENUM) \ > ? RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (HOST_WIDE_INT) \ > : (ENUM) == REG \ > ? RTX_HDR_SIZE + sizeof (reg_info) \ > I can confirm that with this patch we now get past the previous point of failure on the affected machine. Thanks for turning this around so quickly. R.