From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id C8DB93882179 for ; Thu, 13 Jun 2024 13:33:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C8DB93882179 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 C8DB93882179 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718285638; cv=none; b=cm4bOMuRLSQ1xHjJmnUfxL9CjjHqW64k9AwmHXrqcQ97A066I2SE7EZUioHwnyMndRTL2Ih1EwiibaivYy8o2JRWty+EnMEBKy/Fg5y8BhtVxDMyoaWRlEHHv/0PJ8RdJa6X1avR8wSulckwrmm/80e/r0Zn+s8u2IRHbeyeyZ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718285638; c=relaxed/simple; bh=JM5SGdX7ekOkb6V4LOCbjJiL9RdrVPVvpzH3o0uZd9M=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=INulcjPkMErzVhJq8iJbXUxLM0IecPWjOPsIr/NRciO/hEjV3xyM8jGixZyysNiG5JRWq7wCHJimrMmjR7BTWHwniGk4VCtZf4pdiA+Cz8B3KJeMRVi+QKUK9i3UFNYKQb6NtQTdL7nEk7YJr88UfCPt+WR3cbpJ3aUJEINE+WU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-421d32fda86so12240965e9.0 for ; Thu, 13 Jun 2024 06:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718285634; x=1718890434; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U+8LK4G/fnHR5h8gSfXQUEu3s6p6oPERFc/+ZmhSRzk=; b=WOBRIOKhR9fnBL9BgSemiqLZe6ow4W6gsBs2GRKdkkB9ULLyaWvHnvU7vh1CP57+Xz PCa6yo3E5pOOG+x87qwAJjX0+Gy6N6Yd9IJsAeVU7FJpaj0KVlXvC7lstHpBWe7gaVoM /5rXY2Yyjfu+dM6QP+u6gJizmu6PCuE62cT58y9C7i16CHKt8OdghF5WSvjUMNKj2aWt Uane3lWxhE58D+IDi0Tnzwoh7Df2CH7a2EDSqrjeSeSLk1lwX8/JITDUuIr9g96FB5su QLfoG+TUO4UtqQf4gX6WiEYz/oG9P2bsZJ3rdHYnQDzMmwTQDFv4uMhPXmNBoZHLTPps PUJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718285634; x=1718890434; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U+8LK4G/fnHR5h8gSfXQUEu3s6p6oPERFc/+ZmhSRzk=; b=Soo2NVDtxay/00Lgyef0DdVrNkaYn7dOeOHYs1jh9sCD7kVcl18aq/xhe1+KiH9WFa EEY8oEwV8pEkNV2ChhK8gYVdxHItdrrT8mrRyHj9qNXVX7JzEvsW5c+aUUxeDqUxOLMh 3Mm42Yqe7dxjRv1UbSQ8T2SMZqLzeQ2bgUwfcHvWT18swu//fPRfTeEILcRp7nDML1c/ 4j/YsIZZGsq73G/lQCjTxOKcTN+u7138bUNiLroKMoRO0mIwUvNBfcpTmH0ojXsFgl52 gXX3wBDVFV4RBYVvDG6HlMhwYh2TbwJRg13CxFRXX6vuDZPWj+xTGw3x6iRIC8seo9Ib vwBg== X-Gm-Message-State: AOJu0YwAvAGi9uvk3ujnTNkuHW4ex7l6iuI4V2rWQK59yd6IxlvmqiPO yWrtNeAN5/ETS/2bUl2/ltPaODe05n2etLrnem9U0ZZdbaH0Qfdoy9pzx/wFaWKZfowGZvpQXDQ = X-Google-Smtp-Source: AGHT+IHE2nDs2f7Q94prwAPLyLsaImc//AnAqJreL7O7uqG/merKyIcQXG6JFYL27zeIOesf8R0f/g== X-Received: by 2002:a05:600c:42c4:b0:422:6755:17de with SMTP id 5b1f17b1804b1-422867c90f9mr48570255e9.41.1718285634397; Thu, 13 Jun 2024 06:33:54 -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 5b1f17b1804b1-422870e9145sm62391955e9.22.2024.06.13.06.33.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 06:33:53 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 06/30] ada: Fix fallout of previous finalization change Date: Thu, 13 Jun 2024 15:33:12 +0200 Message-ID: <20240613133338.1809385-6-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613133338.1809385-1-poulhies@adacore.com> References: <20240613133338.1809385-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 List-Id: From: Eric Botcazou Now that Is_Finalizable_Transient only looks at the renamings coming from nontransient objects serviced by transient scopes, it must find the object ultimately renamed by them through a chain of renamings. gcc/ada/ PR ada/114710 * exp_util.adb (Find_Renamed_Object): Recurse if the renamed object is itself a renaming. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_util.adb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 6ad464e6701..bf95b0e13c8 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -8808,9 +8808,10 @@ package body Exp_Util is First_Stmt : Node_Id) return Boolean is function Find_Renamed_Object (Ren_Decl : Node_Id) return Entity_Id; - -- Given an object renaming declaration, retrieve the entity of the - -- renamed name. Return Empty if the renamed name is anything other - -- than a variable or a constant. + -- Given an object renaming declaration, retrieve the entity within + -- the renamed name, recursively if this entity is itself a renaming. + -- Return Empty if the renamed name contains anything other than a + -- variable or a constant. ------------------------- -- Find_Renamed_Object -- @@ -8877,7 +8878,16 @@ package body Exp_Util is Search (Constant_Value (Ren_Obj)); end if; - return Ren_Obj; + -- Recurse if Ren_Obj is itself a renaming + + if Present (Ren_Obj) + and then Ekind (Ren_Obj) = E_Variable + and then Present (Renamed_Object (Ren_Obj)) + then + return Find_Renamed_Object (Declaration_Node (Ren_Obj)); + else + return Ren_Obj; + end if; end Find_Renamed_Object; -- Local variables -- 2.45.1