From patchwork Tue May 16 08:40:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 94541 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp275914vqo; Tue, 16 May 2023 01:56:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7c1M5JlH6GoNZx89dWCaX2BmFpWjhTIfCvrgbJ9er6Y5nDjKMsydjUpc2NtQcIdvTTNrtq X-Received: by 2002:a17:907:97c2:b0:96b:4ed5:a1d8 with SMTP id js2-20020a17090797c200b0096b4ed5a1d8mr4456911ejc.36.1684227392594; Tue, 16 May 2023 01:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684227392; cv=none; d=google.com; s=arc-20160816; b=cKK7irog2i5A9ywGub6y1FCEQKrCjoRRQz9L1qOVGCPrVJL4dC50Emr/FXVl8vpnZF o6IzT0JJjYxH+u2uLu9Om3GMCGEzmXYlBhFgw9HclTx6DWjn2Q5FHBj2fqu+1CWYpKwe SPZEJxiwFF7YdGBjJfA6KAdVMiMGDDm0IkhUpqk3wy3AhEcmNt8c2JHuzaSK4BLN3gJg s2UhTWWtfqXXPcNY1O8wYYeSySOqfjC5+2kADraedWwjFimEr9nFmAGZACZLTd2pN9qi III4rE0Gj/PwIHsqt/TFgMkcLu1FBGgkODl8PVDMeAtr4mBiSIXApPquPsj9e/CRQSH2 EllA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=/EnUdhiVtyEkPf7cv8WcpJxMIgqYlIp37WmvaoxS3vs=; b=NFlhZDdcG2OyBa0UdTXdlgmXjqbPmNwayOriZwLT8GnHtPfBbMZB+42W7FsreTIaqn jQSAThk087YHxlV64PtyFDppsjzcWNs53Jkfemt8E8GpWgcqi/TCDKPxJLEYlQoFORhw RU3l8OXZexKmHXiOyBnj/P5nhJ7sadxAZ/d+uS72/iiuxOK1fNwgqK11RwDBvmwMPIW1 cAz/C0vGSpDvR21L9Ivj3mPfqFD/YIIDWN4rD2Hc6YY3qauzW5A0WYJPHC77nhsgjO7i 2ZVf0sU3LvQFW12y7Sih7tfsrR9rYL5/eUKc8VP3w+8Tn96cnwMaXiftwn3g6xMpswh4 /sFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=a6WGlZta; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id qb27-20020a1709077e9b00b00965a8995e33si18523413ejc.2.2023.05.16.01.56.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 01:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=a6WGlZta; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5B6DA389942F for ; Tue, 16 May 2023 08:48:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B6DA389942F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684226925; bh=/EnUdhiVtyEkPf7cv8WcpJxMIgqYlIp37WmvaoxS3vs=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=a6WGlZta5A8sv392ux0uQ+E7B+ii8+0HfPI5axCLu7DsZurR879N0bjB4Yz1kDKE9 U1cPX+tkA/xubRE8KKMmGW9G8UqQWhK9GYfDJFa46ojzmfUzXPR9vhi7p3uTorF3CK qtqzP2RHS67xkVaNFAxLqfzZXu8y5UkEThSgY5I0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id ACC8B38708E1 for ; Tue, 16 May 2023 08:40:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ACC8B38708E1 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-309382efe13so154797f8f.2 for ; Tue, 16 May 2023 01:40:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684226439; x=1686818439; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/EnUdhiVtyEkPf7cv8WcpJxMIgqYlIp37WmvaoxS3vs=; b=ONVr/HaqJCMtwP1nEfsdVLvHFe75CLTwhR5OTB6utIZ4PAQEs0r5r74vQg0h0+3g3c Ctu1kyoqYa1vKU5SlvbFngmPD2tp6CGILHwAcDeHXhQz7B+mxmDaIVcf3JRb5YsmiY/V +6bHiKv7EkuKCYHeQMqPuudEq6MqU1pknAYwjDUPbvi2hFcyoGUhcYwp2Y5DRp6h+WVM +EU7arfNEfoLgBfJEuBzk6RlPsZlW6Ebzy0Eu+VUl3B6R33rC+VDSd+vIn12lWwGn3b/ AB8jR5khc+zYT6UzG2lUJ4zA+CgHCWGDl3IVDxipZEBMNw64qruiwQArK/PP1DvHUKv5 rBQg== X-Gm-Message-State: AC+VfDwFGK/uo0p+eKXt5lGQRrn3Qa6Bsj8o/FqxixlqaLMYTrZQnf+/ g65oYNjvjE5ZP3neWuktJ5T6xlNnObsiEkbhwjvHGg== X-Received: by 2002:a05:6000:1c4:b0:2f5:ace2:8737 with SMTP id t4-20020a05600001c400b002f5ace28737mr23323522wrx.32.1684226439107; Tue, 16 May 2023 01:40:39 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id t14-20020adfeb8e000000b002feea065cc9sm1752373wrn.111.2023.05.16.01.40.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 01:40:38 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Follow-up improvement to implementation of storage models Date: Tue, 16 May 2023 10:40:37 +0200 Message-Id: <20230516084037.1501674-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766040422729036827?= X-GMAIL-MSGID: =?utf-8?q?1766040422729036827?= From: Eric Botcazou It avoids to recreate an actual subtype for an explicit dereference. gcc/ada/ * sem_util.adb (Get_Actual_Subtype): For an explicit dereference, return the Actual_Designated_Subtype if it is present. (Get_Actual_Subtype_If_Available): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 8bce0229867..ad74de6b6f6 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -10017,6 +10017,14 @@ package body Sem_Util is then return Actual_Subtype (Entity (N)); + -- Similarly, if we have an explicit dereference, then we get the + -- actual subtype from the node itself if one has been built. + + elsif Nkind (N) = N_Explicit_Dereference + and then Present (Actual_Designated_Subtype (N)) + then + return Actual_Designated_Subtype (N); + -- Actual subtype of unchecked union is always itself. We never need -- the "real" actual subtype. If we did, we couldn't get it anyway -- because the discriminant is not available. The restrictions on @@ -10130,6 +10138,14 @@ package body Sem_Util is then return Actual_Subtype (Entity (N)); + -- Similarly, if we have an explicit dereference, then we get the + -- actual subtype from the node itself if one has been built. + + elsif Nkind (N) = N_Explicit_Dereference + and then Present (Actual_Designated_Subtype (N)) + then + return Actual_Designated_Subtype (N); + -- Otherwise the Etype of N is returned unchanged else