From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78056 invoked by alias); 17 Oct 2017 20:06:15 -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 78045 invoked by uid 89); 17 Oct 2017 20:06:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Oct 2017 20:06:12 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E196CAE56; Tue, 17 Oct 2017 20:06:09 +0000 (UTC) Date: Tue, 17 Oct 2017 20:09:00 -0000 User-Agent: K-9 Mail for Android In-Reply-To: <20171017192946.GB14653@tucnak> References: <3e7ecb64-cd96-47a3-cb75-53e41317d90c@acm.org> <20171017192946.GB14653@tucnak> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: Unbreak Ada bootstrap (was Re: [PATCH PR/82546] tree node size) To: Jakub Jelinek ,Nathan Sidwell ,Eric Botcazou ,Pierre-Marie de Rodat CC: GCC Patches ,Jeff Law From: Richard Biener Message-ID: <8ADC17F6-03C1-4FCA-B81E-010B437C7F35@suse.de> X-SW-Source: 2017-10/txt/msg01099.txt.bz2 On October 17, 2017 9:29:46 PM GMT+02:00, Jakub Jelinek = wrote: >Hi! > >On Fri, Oct 13, 2017 at 02:29:40PM -0400, Nathan Sidwell wrote: >> [Although I filed this as a middle-end bug, it's really a core infra >bug, >> not sure who the best reviewer is] > >> 2017-10-13 Nathan Sidwell >>=20 >> PR middle-end/82546 >> gcc/ >> * tree.c (tree_code_size): Reformat. Punt to lang hook for unknown >> TYPE nodes. > >This change broke Ada bootstrap, because the FE doesn't have any >tree_size >langhook, but has one language specific tcc_type tree - >UNCONSTRAINED_ARRAY_TYPE. > >Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok >for >trunk? OK.=20 Richard.=20 >2017-10-17 Jakub Jelinek > > * langhooks.h (struct lang_hooks): Document that tree_size langhook > may be also called on tcc_type nodes. > * langhooks.c (lhd_tree_size): Likewise. > > * gcc-interface/misc.c (gnat_tree_size): New function. > (LANG_HOOKS_TREE_SIZE): Redefine. > >--- gcc/langhooks.h.jj 2017-09-12 17:20:17.000000000 +0200 >+++ gcc/langhooks.h 2017-10-17 19:49:29.277324006 +0200 >@@ -307,10 +307,10 @@ struct lang_hooks > /* Remove any parts of the tree that are used only by the FE. */ > void (*free_lang_data) (tree); >=20 >- /* Determines the size of any language-specific tcc_constant or >- tcc_exceptional nodes. Since it is called from make_node, the >- only information available is the tree code. Expected to die >- on unrecognized codes. */ >+ /* Determines the size of any language-specific tcc_constant, >+ tcc_exceptional or tcc_type nodes. Since it is called from >+ make_node, the only information available is the tree code. >+ Expected to die on unrecognized codes. */ > size_t (*tree_size) (enum tree_code); >=20 > /* Return the language mask used for converting argv into a sequence >--- gcc/langhooks.c.jj 2017-05-21 15:46:13.000000000 +0200 >+++ gcc/langhooks.c 2017-10-17 19:47:13.973960166 +0200 >@@ -266,8 +266,8 @@ lhd_gimplify_expr (tree *expr_p ATTRIBUT > } >=20 > /* lang_hooks.tree_size: Determine the size of a tree with code C, >- which is a language-specific tree code in category tcc_constant or >- tcc_exceptional. The default expects never to be called. */ >+ which is a language-specific tree code in category tcc_constant, >+ tcc_exceptional or tcc_type. The default expects never to be >called. */ > size_t > lhd_tree_size (enum tree_code c ATTRIBUTE_UNUSED) > { >--- gcc/ada/gcc-interface/misc.c.jj 2017-08-31 23:47:18.000000000 +0200 >+++ gcc/ada/gcc-interface/misc.c 2017-10-17 19:48:39.715923329 +0200 >@@ -343,6 +343,23 @@ internal_error_function (diagnostic_cont > Compiler_Abort (sp, sp_loc, true); > } >=20 >+/* lang_hooks.tree_size: Determine the size of a tree with code C, >+ which is a language-specific tree code in category tcc_constant, >+ tcc_exceptional or tcc_type. The default expects never to be >called. */ >+ >+static size_t >+gnat_tree_size (enum tree_code code) >+{ >+ gcc_checking_assert (code >=3D NUM_TREE_CODES); >+ switch (code) >+ { >+ case UNCONSTRAINED_ARRAY_TYPE: >+ return sizeof (tree_type_non_common); >+ default: >+ gcc_unreachable (); >+ } >+} >+ >/* Perform all the initialization steps that are language-specific. */ >=20 > static bool >@@ -1387,6 +1404,8 @@ get_lang_specific (tree node) > #define LANG_HOOKS_NAME "GNU Ada" > #undef LANG_HOOKS_IDENTIFIER_SIZE > #define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct tree_identifier) >+#undef LANG_HOOKS_TREE_SIZE >+#define LANG_HOOKS_TREE_SIZE gnat_tree_size > #undef LANG_HOOKS_INIT > #define LANG_HOOKS_INIT gnat_init > #undef LANG_HOOKS_OPTION_LANG_MASK > > > Jakub