From patchwork Tue Oct 17 19:29:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 827257 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-464365-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vdNsI0EA"; dkim-atps=neutral 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 3yGldd2r9jz9t2Z for ; Wed, 18 Oct 2017 06:30:12 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=CqRjzM4F2r8CYGXSv hLiaKLMvNo6v5nNRTuQD+hsdrqrA4luMqgzMScT4Z2lsrrBZrJEEzV+LniGhzxbs QHGPYLwVoif7BTS5maup7N3hJIK77dPtge94V3zEQAdwIsEjIvGUkk4uKZXKGPy1 FokCaxmT+AP+j0b/a5a0LVBkSA= 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:date :from:to:cc:subject:message-id:reply-to:references:mime-version :content-type:in-reply-to; s=default; bh=ozG/nRcUSuT1Mhl/kBamtR1 9qGI=; b=vdNsI0EA+WdaqKOlbib0qxKJjImAj6m+TLMIYbGxIUvoMU/msRJG0u1 R1MGuTEVd3KbgGnWD2+eKLcLZW4//VHGHk531htlrolUJ4F4cfquQjJE5q71HYBU Lp2ZP5dVl+EX2BL9yfMUt5/s1DoGAsYXlth3wc9035/1u1syGopo= 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-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 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 21:29:46 +0200 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-Disposition: inline In-Reply-To: <3e7ecb64-cd96-47a3-cb75-53e41317d90c@acm.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes 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. Jakub --- 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