From patchwork Tue Nov 7 09:19:15 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: 162329 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp111572vqo; Tue, 7 Nov 2023 01:20:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvZkQV4IGv83zaOeyrZeBBj1rxqwqY4UZV5hIsekzB2pXqus4lVd1CRjtKG1JRDULhcV0h X-Received: by 2002:a05:6214:262b:b0:66d:fac:33f9 with SMTP id gv11-20020a056214262b00b0066d0fac33f9mr36915021qvb.11.1699348854651; Tue, 07 Nov 2023 01:20:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699348854; cv=pass; d=google.com; s=arc-20160816; b=PWUohEYATJABY4g+2mX6Z1AM043w1SqdxVhAwtcrDDmh53qrbddGBILq9mBG3mG6jg BgTGWs3IhYBd/V3q3026o+SRA2y3ChiMgkvs+rVZNdY/ohkxotc14iuci7ay68TrGCvM +HFjqNeKFGoWMWGEdRuskXUReYwWdTIkT6JvrdmMzZekIj8qRF6wxkEzG4Y8ItEZJlmC bUujgyMaijw12WAPo/hqoQLSdJPFnUaYQqDCXb0n26p35tjZ9oMvPiE0bm5KiigPU5vO nEbmH9zitHxj5du0s3Rjs4iYuw1LJR6IrPMtrQc9xAykTRcOb6KY9u9O6bDBQFI/dP3D RGqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=LTEMZJE6yQsCQIomBUV/aERAmcfdBSz4GXYL6XcQqXg=; fh=QRb7QY4BZ0mIIAPiH2G4K0PcYKRtRn2i5A6VLUA8cN4=; b=a+YW5QM7YnBaLJrBf54+JWHQsnxLuhPkCq6kVGBFGl/Ab77rbLmowTPEnFIOXxFZ1b E2W60OJimT3BWpdx+MSHOC/loBBunO+V0Wyix2iwkXmBVAFyHLpYfq7v8iBelkiuucWR 6+i0Hqkvk60ns8yKb12P531VLq06diDRyITMPz7XcnHz9wqRL6tLQwoxrV3USb7AiY2l 7TKJzOZJR8ZRxB3AADZEjaZ+VcWiVKijBPWAtZVxxyHVEoTCqsAMov9Kjws9RZuUajgu 5r/qKNmilxYoxR7SEzYCPPXPfOPQ2EFHRs76QIRkX7nYIWpwqrssg9VyZ3Ry0l3JUTg7 ZWDQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=d2CAyMVE; arc=pass (i=1); 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=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id i14-20020a0cf94e000000b0066d0656ef0esi6935284qvo.615.2023.11.07.01.20.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:20:54 -0800 (PST) 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=@adacore.com header.s=google header.b=d2CAyMVE; arc=pass (i=1); 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=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3BDBF3857031 for ; Tue, 7 Nov 2023 09:20:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id EE5AB385700D for ; Tue, 7 Nov 2023 09:19:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE5AB385700D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EE5AB385700D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::430 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348762; cv=none; b=L0CSG/rfYUo3y99/N5KmWPLCczmzEfQCqBkMg5SszvS3KN+reGQv3Sj1qHOlRBwuUyuSm7fmaBibyou/UqgZ606E6LNaEoAqvYpmVmgJH73RQYmlJa3xshzJWBowgSM3E19o9bTENmPFue44nKe21UW2uIPaZAvHo3qYsMr1WTY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348762; c=relaxed/simple; bh=U8+cKtnE8JKT41Uc4YnTod9jRdtiCyciMIGXKhpQMRw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=VRzuPQX+fRNW4fXEIiCdOsbEgkpDeloC+ckpDEaQhRomzqC8RrbDIy6/sZnVInfwsD7XWrdj12mGTAX3bP3dXje8x8BLnces7/wWDTW4aJ+Gl2dkNT3pHkP9o83FOjgtDIkgxGWvangR2PSSfPldMj+P6P9pFWfL7c/W+NNkGLY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-32d849cc152so3683542f8f.1 for ; Tue, 07 Nov 2023 01:19:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1699348758; x=1699953558; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LTEMZJE6yQsCQIomBUV/aERAmcfdBSz4GXYL6XcQqXg=; b=d2CAyMVECcxvtFBOpsc/X3494g9kgcR+mKQaiq3vBIwZ0YKVPUz4I4Su75ua40psH7 8/LarvOWONtsWxIQg1y4J7rciEFnfbw7bWQdzrXar9ImXYXMelLC0ZFufFYuF4hJy4Bh vouzCprJ6seTnmhWb/PLxsKqcIW1spa4M2jxE5L6UZD60wv+EVK2gdnrWlckMOjTZZ/V QHo+QO8xPUsG7GYh9ISpyfBYQW+BT7AHfjfMe5BFXMOgZYLkN6WUn+5b2nyQ+eqQ4J28 fu8mogIXcsjkPZZbUpkwu6kYWlQL6MZvKhU6mYWKVDPTcHKZzIHszyQ9NBQFJ8ShH3qh RXrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699348758; x=1699953558; 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=LTEMZJE6yQsCQIomBUV/aERAmcfdBSz4GXYL6XcQqXg=; b=dYLhJJqH3FeSlkchwdTgeJY4G6P3uCz1B9hUHhP1A/TcGROzN7Y+uHs+yOT8OpixbW AV9FVMG7u+HNk+60yKPfDr5ir7HtWC7vjpdNbfJLnmfUYKcUdsdfWrqGLr1gq6DbXhQF mtORGWRd/MACsxheE2jCF/i+5PqbP/iUbUcMTrIJ23JNZx/2OQkCZvYejVvUccKTal47 +Rz7ltUhasJHzTj3EqO+2zKjHdGapIqBbZLOt8EEWC9FqOVAz99PYYPZfRrtVhrqRQvq Y45G5uyM+GjMTYhGLJsJKPkHTt/M0QYo05p9SxoNcaHIxeUOBkfvT6pn86uQTWQGuNrF oADw== X-Gm-Message-State: AOJu0Yx5eIbFErlLX7CAk6eEFBt7aEnf5BuQmX4+1rFcmE5OW+ToUnjM ZSQUH1keSQMUwuKBGOyIPbhEBDYjSAfbbJoeZGxMTA== X-Received: by 2002:a5d:4b52:0:b0:317:6ea5:ab71 with SMTP id w18-20020a5d4b52000000b003176ea5ab71mr21823690wrs.30.1699348758752; Tue, 07 Nov 2023 01:19:18 -0800 (PST) Received: from localhost.localdomain ([2001:861:3382:1a90:dbc1:a1d1:2e58:4040]) by smtp.gmail.com with ESMTPSA id z2-20020adfec82000000b003232380ffd5sm1788924wrn.106.2023.11.07.01.19.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:19:18 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Fix handling of actual subtypes for expanded names Date: Tue, 7 Nov 2023 10:19:15 +0100 Message-ID: <20231107091915.3905306-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781896424226062371 X-GMAIL-MSGID: 1781896424226062371 From: Piotr Trojanek gcc/ada/ * sem_util.adb (Get_Actual_Subtype,Get_Actual_Subtype_If_Available): Fix handling of expanded names. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 5440c6ae0aa..da531e53466 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -10104,7 +10104,7 @@ package body Sem_Util is -- formal, or a variable or constant object, then we get the actual -- subtype from the referenced entity if one has been built. - if Nkind (N) = N_Identifier + if Nkind (N) in N_Identifier | N_Expanded_Name and then (Is_Formal (Entity (N)) or else Ekind (Entity (N)) = E_Constant @@ -10225,7 +10225,7 @@ package body Sem_Util is -- formal, or a variable or constant object, then we get the actual -- subtype from the referenced entity if one has been built. - if Nkind (N) = N_Identifier + if Nkind (N) in N_Identifier | N_Expanded_Name and then (Is_Formal (Entity (N)) or else Ekind (Entity (N)) = E_Constant