From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111005 invoked by alias); 17 Oct 2017 19:29:59 -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 110992 invoked by uid 89); 17 Oct 2017 19:29:58 -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_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Oct 2017 19:29:55 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B49A1F582; Tue, 17 Oct 2017 19:29:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3B49A1F582 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jakub@redhat.com Received: from tucnak.zalov.cz (ovpn-116-223.ams2.redhat.com [10.36.116.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7D815167E; Tue, 17 Oct 2017 19:29:52 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id v9HJTnpJ003200; Tue, 17 Oct 2017 21:29:50 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v9HJTkR0003199; Tue, 17 Oct 2017 21:29:46 +0200 Date: Tue, 17 Oct 2017 19:31:00 -0000 From: Jakub Jelinek To: Nathan Sidwell , Eric Botcazou , Pierre-Marie de Rodat Cc: GCC Patches , Jeff Law , Richard Biener Subject: Unbreak Ada bootstrap (was Re: [PATCH PR/82546] tree node size) Message-ID: <20171017192946.GB14653@tucnak> Reply-To: Jakub Jelinek References: <3e7ecb64-cd96-47a3-cb75-53e41317d90c@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3e7ecb64-cd96-47a3-cb75-53e41317d90c@acm.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg01090.txt.bz2 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 > > 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? 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); - /* 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); /* 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 } /* 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); } +/* 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 >= 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. */ 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