From patchwork Tue Jan 9 13:15:29 2024 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: 186366 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp98902dyi; Tue, 9 Jan 2024 05:17:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHn9Kx0D60ideEOWOHRjR3e2hE5qZhKWWYCArviivahojlATkjz0SSCpkzMJXpUtQK3vWih X-Received: by 2002:ac8:5f4b:0:b0:429:7990:4a3e with SMTP id y11-20020ac85f4b000000b0042979904a3emr7189090qta.7.1704806237741; Tue, 09 Jan 2024 05:17:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704806237; cv=pass; d=google.com; s=arc-20160816; b=anwYwhztS+Kro1/bPIZs+STwLwb2dc6cG30Ao7VGXIhlmr9lyN2xhMw9ZZ9q8ujz/X 6vzD8aHKOmfMv8GoUJ/bIRsLPwtDJTeEqaVw2ujiYmD6xuvgJ7yYV3haM0EMC0GwkWfh 1HSdT07f1AklORjZ6EzpaZ55KuNSb3QoMvFObDHfCrp/2CMphas+iEjNCVedAZMyTyhW p+HwTjB+Qef6RXn9f1mXWofShfNQAVnRh+HEY3johNUVNyuZhiD34o1oM5yWfff/wqJH Uia791xxVPuewVAKYiI5iLK9bV/VHvM+37k/wd3D+edRYWBnzveK5H8VqL6LpzQFf42M rpgA== 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=Oz81wkFSDBCr1F/mwThztUD//SwctuqhIlIgYfviZxY=; fh=SwZJ83OSkcrddnVqQxMJIeT7CBiRDh1+Xn8c83Fto+4=; b=JRDp2U3rAFlxiBrRlwakMZNNc0o4gvbGdx30IMCHDkPIw0uTew7NiQoCM8OK35N51R ZxNf+AH5QL4UM+DpCtu7MdVIG+AB+PjA95BIX2PMFLsJ/B5yhncr4dwAN1AaCfJlez1A fseyP7kORW/DN0+YpC2nfX7kzgBZxRB7VvW34k5eeo1ETs11CgBKKch5bS6CR70xHG4l b5B3u9LRyk3Q5Fja9acsw+w6/n8gXC0XeWbuC0meaJT/HI3yjmnzJq3gHBAyXZN32l1A WNrO/2KPnu9EvXxuhiwbzDZJvTb94EJJjn0wJLL2gZLjrCyfw/iu68cF1ZKO6KPWAvOA bBPA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=k2stQNGc; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 10-20020a05620a040a00b0078331c54b68si427258qkp.448.2024.01.09.05.17.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:17:17 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=k2stQNGc; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8AB6F3861028 for ; Tue, 9 Jan 2024 13:17:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 8ABD4385E021 for ; Tue, 9 Jan 2024 13:15:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8ABD4385E021 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine 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 8ABD4385E021 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704806133; cv=none; b=U1nzIdTSRSzCiXeZWFEJvfYkkmJZD/lZN2Ru9FsNaAyqwMhM8u52EOrmUYcaq/X63DRCkVcfG3PSpXzLqwNYqEkTd629epinjaCnvmaTEvpVQYzxm5t+nJ8AHQ4azwabnE0DQRHCT/hlae32fbGCVbQIzkHsAtoV7648Mp/fLxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704806133; c=relaxed/simple; bh=kPguiXM/eJ6zQInmtfiSUoP32KP2y909lVV95KzXS4E=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=XEOn8PcPMUkCFn4GTB5iJCtBFx84XF+15PGqbQoCCmdRZjSOpqLXKzSgqYGQF2Lzn7pAbJ1LPRDZRMCpf1M8kga5BoQEdCSCYKO4uiVYnp+YdU3a4RHI3d0SuaJ0GPrYZbDLc5LVbDjq+vlVD12pIjUm7n0cSKAF9P2gGHyh/FM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33748c4f33dso2813676f8f.1 for ; Tue, 09 Jan 2024 05:15:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1704806130; x=1705410930; 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=Oz81wkFSDBCr1F/mwThztUD//SwctuqhIlIgYfviZxY=; b=k2stQNGcbs31AdCJsZsbbiKzD+ML/VWRbBsiNveKjWmG65ICnoqZBz2ksEQmiL1KqS iWcBfGJ/n0NGNvqBKJneqzjPdXKzFvcRf9nWXCIgljUVnX5LGvNtTpDSaMHrnBuoeGOj +faeFga9NvSvLTOb6efNxoh4ozkfCuGVjVsFsSXBXMHEDi9JxheFeInF4E9MQEVGGPDR YFkqW26II+T68uo1gChSKVQ/OrQwwcR/g4jaiGVeyhgHcB9lwLU9RUcdEkIRTLc97XqH SSvV9zGcY26b9+iD3TbnyU1vivLtuQOBlKe81Qu9CucD6PmNDIo4g8Yk+U78B5BmBP8l syJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704806130; x=1705410930; 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=Oz81wkFSDBCr1F/mwThztUD//SwctuqhIlIgYfviZxY=; b=Bh2IOsxwr39T98MXp6cH/VxEXcDmrCH0AV0WOASIwKPzTIqHqXsemr39Za68vsOd5O EvD7e6JlDo5JARLHcmkY2DYRD5hyc7EJ5Mbv8mdFus6EII1hcTgrQlmezvAdpDza5kzU 9U0LTYcV5FfLXBt5S0bi9rUX6aaeF1chJGeFqA20xPgch0L2LLtUywbNPt9HFibmuPo0 hzO0XhSzAKB0rqXwZ8DMOmrSP60hluKBoQYKkjTSuB+Qa0ny9IvGwGxMEFE+l8coWBbF 2yuPbrlm0g2Wg1bUuYixVowrQPcALTpwyN4OxySrTQI6Gdf83gDlTj62sBjxkgU99g8y FBxw== X-Gm-Message-State: AOJu0YwILsnaeOFI4ZUOfEXJ/m3iZ4YRik5qMdAp99/7LOwUvH1JuaIV gy6a0CSr44tr6X/OR2Whq38WHlirY/Y3KqDPPcEeUgOvAA== X-Received: by 2002:a05:6000:1147:b0:337:3f81:a012 with SMTP id d7-20020a056000114700b003373f81a012mr607331wrx.99.1704806130222; Tue, 09 Jan 2024 05:15:30 -0800 (PST) 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 c2-20020a056000104200b0033642a9a1eesm2390528wrx.21.2024.01.09.05.15.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:15:29 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Bob Duff Subject: [COMMITTED] ada: Avoid xref on out params of TSS Date: Tue, 9 Jan 2024 14:15:29 +0100 Message-ID: <20240109131529.743785-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 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: 1787618905596116029 X-GMAIL-MSGID: 1787618905596116029 From: Bob Duff For an actual passed as an 'in out' parameter of a type support subprogram such as deep finalize, do not count it as a read reference of the actual. Clearly these should not count. Furthermore, counting them causes different warnings in -gnatc mode compared to normal mode, because the calls only exist in normal mode, which would disable the warnings. Such warnings now occur in both modes, instead of just with -gnatc. gcc/ada/ * lib-xref.adb (Generate_Reference): Do not count it as a read reference if we're calling a TSS. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/lib-xref.adb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index 3d6b29862b3..340f5ca73ae 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -29,6 +29,7 @@ with Einfo; use Einfo; with Einfo.Utils; use Einfo.Utils; with Elists; use Elists; with Errout; use Errout; +with Exp_Tss; use Exp_Tss; with Lib.Util; use Lib.Util; with Nlists; use Nlists; with Opt; use Opt; @@ -789,10 +790,15 @@ package body Lib.Xref is elsif Kind = E_In_Out_Parameter and then Is_Assignable (E) then - -- For sure this counts as a normal read reference + -- We count it as a read reference unless we're calling a + -- type support subprogram such as deep finalize. - Set_Referenced (E); - Set_Last_Assignment (E, Empty); + if not Is_Entity_Name (Name (Call)) + or else Get_TSS_Name (Entity (Name (Call))) = TSS_Null + then + Set_Referenced (E); + Set_Last_Assignment (E, Empty); + end if; -- We count it as being referenced as an out parameter if the -- option is set to warn on all out parameters, except that we