From patchwork Fri Aug 30 15:33:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1155965 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-508053-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="O9KkF+Zp"; 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 46Kk5V4Ywxz9sML for ; Sat, 31 Aug 2019 01:33:16 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=EIq8c1LWywinyEmw mjFBQ6a8YZOmwCa2LzdssGFyvHq8KwdWqIAnHnpN/n/e2j9RfZQb+xA/a+SyFgQ7 gyKmqV8uUJ6QJfM95j7GvqONAsKWM2H3HjZmpR5Y9YFd7ZOl5g7mJ0f+G1vaGxtf kFHhq+9knVB4WBrm3pU2mvEL94M= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=XK15A7E1ZZJDptFttkkzQY jRRZ4=; b=O9KkF+ZpWO7Wg4+70Fc1cA17ZXhBivgKxVTEEwo9vgjE5/kVlBe4GE GsKkFCcTxPFAFLGHRm1DwVJjfQbZZIjGLfn/vSsi8WKJn9e0BriZMc0sPNGK/ppQ B6bm35Bl+9eem87HTEm7jFAAE1Qe+ve94fA88yLUVAf3m4TZshrmw= Received: (qmail 15350 invoked by alias); 30 Aug 2019 15:33:09 -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 15338 invoked by uid 89); 30 Aug 2019 15:33:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=bitsizetype X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 30 Aug 2019 15:33:07 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 6208781392 for ; Fri, 30 Aug 2019 17:33:05 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nilrtT3hItns for ; Fri, 30 Aug 2019 17:33:05 +0200 (CEST) Received: from arcturus.home (unknown [IPv6:2a01:e35:8a16:3850:36e6:d7ff:fe66:317b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 3B60281387 for ; Fri, 30 Aug 2019 17:33:05 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Saturate the sizes for the target in -gnatR output Date: Fri, 30 Aug 2019 17:33:16 +0200 Message-ID: <1849424.VE4vyoWEjc@arcturus.home> MIME-Version: 1.0 This changes the saturation from the host to the target for the large sizes displayed in the the -gnatR output. Tested on x86_64-suse-linux, applied on the mainline. 2019-08-30 Eric Botcazou * gcc-interface/decl.c (maybe_saturate_size): New function. (gnat_to_gnu_entity): Invoke it on the Esize of types before sending it for back-annotations. * gcc-interface/trans.c: Fix typo. Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 275198) +++ gcc-interface/decl.c (working copy) @@ -232,6 +232,7 @@ static tree build_position_list (tree, bool, tree, static vec build_subst_list (Entity_Id, Entity_Id, bool); static vec build_variant_list (tree, vec, vec); +static tree maybe_saturate_size (tree); static tree validate_size (Uint, tree, Entity_Id, enum tree_code, bool, bool); static void set_rm_size (Uint, tree, Entity_Id); static unsigned int validate_alignment (Uint, Entity_Id, unsigned int); @@ -4327,9 +4328,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gn { tree gnu_size = TYPE_SIZE (gnu_type); - /* If the size is self-referential, annotate the maximum value. */ + /* If the size is self-referential, annotate the maximum value + after saturating it, if need be, to avoid a No_Uint value. */ if (CONTAINS_PLACEHOLDER_P (gnu_size)) - gnu_size = max_size (gnu_size, true); + gnu_size = maybe_saturate_size (max_size (gnu_size, true)); /* If we are just annotating types and the type is tagged, the tag and the parent components are not generated by the front-end so @@ -4365,7 +4367,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gn gnu_size = size_binop (PLUS_EXPR, gnu_size, offset); } - gnu_size = round_up (gnu_size, align); + gnu_size = maybe_saturate_size (round_up (gnu_size, align)); Set_Esize (gnat_entity, annotate_value (gnu_size)); /* Tagged types are Strict_Alignment so RM_Size = Esize. */ @@ -8723,6 +8725,19 @@ build_variant_list (tree qual_union_type, vec::create_ggc (512); } -/* Destroy data structures of the decl.c module. */ +/* Destroy the data structures of the decl.c module. */ void destroy_gnat_decl (void) Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 275198) +++ gcc-interface/trans.c (working copy) @@ -8790,7 +8790,7 @@ gnat_to_gnu (Node_Id gnat_node) 5. If this is a reference to an unconstrained array which is used as the prefix of an attribute reference that requires an lvalue, return the - result unmodified because we want return the original bounds. + result unmodified because we want to return the original bounds. 6. Finally, if the type of the result is already correct. */