From patchwork Thu Aug 8 14:29:46 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: 1970582 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=bMmNkYXZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WfqGv2yrgz1yfC for ; Fri, 9 Aug 2024 00:31:19 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 41FF6384DEE0 for ; Thu, 8 Aug 2024 14:31:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id A9E2B384DEE3 for ; Thu, 8 Aug 2024 14:30:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A9E2B384DEE3 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 A9E2B384DEE3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::236 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723127442; cv=none; b=cWEBrE/euqoKQ7kwyvT/JFctliWsNsVsE0P2AlkY+e1kTSyHVpx2xTv0C9lKWTcXqFcy6ANPACGreMDdmbkftQSqEXr5dlIHt2zUpXENOyvYpSEFESbZ7jTx8KzH1n1fv3d3HgY6jQ8GrLfHEsfEH9gIKrFLmSiyF4qa73A0aEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723127442; c=relaxed/simple; bh=d4pxZH2l/8M6W/fW+cq9ZKRHWBUN1KfN9qRGamcnP0s=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=GxpBf8yW0hgdajr7xWjgABA0LsMavoUPIH4ly9R4X7BVYNKhFXqb+AJwGhNa3ye9X+/WU3xtsAdryrHs1hWrOMdJnqhQpXws1NQW3QpuketFz0iMgSUD3qaZWfEIAIkk+gqoit4jWhB0BoZgnofSKcm1qQ+Rd3Gwbg6P1uL/uNw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2ef2d96164aso10172991fa.3 for ; Thu, 08 Aug 2024 07:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1723127437; x=1723732237; 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=YJcqK4n2+01FQjJzdRQUOtgtA1b6J8bnbOz0jqLi7hM=; b=bMmNkYXZnvIV+JSEpKfOHjf8m8QJgrtyHz/QtgCT5yamw4IKXGcoc7esAx+H9E08Ri Y9wz88zA4aEDly+4EY5rnyaA7iEx66cRYHGRj8Y0459howhsfGdG18JNLyVELlBUXpH2 OkdVbIKCrQ/2eu6VhwjRwvc4gj0vlAKV2lgMa5uVCtqK/Kgv2OixvD1IcnMipLxiGhZ1 ZrSvSM+mms9OXLn+Pqp9LDIk1wgo+n00OUYC/n/IrDNUtH4api5NcjOpAE73WjkUHWLC fO23ga/e+JxIlIO2QK+PW9uUG2n3MRBtbeFxQECaGnPcLG30GqxzW/Zk+o7ax4rkQPLK L1gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723127437; x=1723732237; 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=YJcqK4n2+01FQjJzdRQUOtgtA1b6J8bnbOz0jqLi7hM=; b=acwY46zuPp6stIYZ91L0P7WRNw7rLHNIE43nyAvHeefI4NK1jxxQ4RuoLDt4sdE+CV m2IQCC1w7eMGGnnB+4ZDEwQjLHAlRWTH29mYwUjMAHcBlitbzASAOYRF9jBADo0O5VGr 2MpQuqExrMmCJI/hZ9Ih+xYi+drzyavfmM2iIA9oETCNf3/a+VabOeUxAbi7bRWR8tu0 S2XoOoiRc9YWyUjSOvd4pgdSHR6Efut/H1Ppx0VM4qZNQryHeUKoRQdqsoZqaPqG/bpf raOQuVh11wrYUt7iTOJqMW0NoBJIPYua7xZATRVUMZh/ItCkSl1Eteh95pY7vHAaDVOr wgDw== X-Gm-Message-State: AOJu0YzLC/zgLW0vO8kWNYnAwfQNctXekUVu579Xr0JuS5e6V3IFsbL6 FTR82C+ccHhGeBBbe8uti/rHAxjbtC2FQDWbjpwLT5Cyemm0QskKOIkIotyXMuv700USuhyYInQ oiQ== X-Google-Smtp-Source: AGHT+IGRgV/LaKPJTwrsMLH6b6HFKgkfA6W0TLn0LvaFNz3Pi1MS0Ex1P70OfVcEb9Pu4p+ARTqDNw== X-Received: by 2002:a2e:9c83:0:b0:2ec:55b5:ed45 with SMTP id 38308e7fff4ca-2f19de3b2eemr15078531fa.24.1723127436815; Thu, 08 Aug 2024 07:30:36 -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-4290c72d6c8sm25992015e9.9.2024.08.08.07.30.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 07:30:35 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Gary Dismukes Subject: [COMMITTED 4/6] ada: Run-time error with GNAT-LLVM on container aggregate with finalization Date: Thu, 8 Aug 2024 16:29:46 +0200 Message-ID: <20240808142948.807190-4-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240808142948.807190-1-poulhies@adacore.com> References: <20240808142948.807190-1-poulhies@adacore.com> 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 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~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Gary Dismukes When unnesting is enabled, the compiler was failing to copy the At_End_Proc field from a block statement to the procedure created to replace it when unnesting of top-level blocks is done. At run time this could lead to exceptions due to missing finalization calls. gcc/ada/ * exp_ch7.adb (Unnest_Block): Copy the At_End_Proc from the block statement to the newly created subprogram body. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch7.adb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 72f0b539c2e..640ad5c60b8 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -8932,7 +8932,8 @@ package body Exp_Ch7 is Defining_Unit_Name => Local_Proc), Declarations => Declarations (Decl), Handled_Statement_Sequence => - Handled_Statement_Sequence (Decl)); + Handled_Statement_Sequence (Decl), + At_End_Proc => New_Copy_Tree (At_End_Proc (Decl))); -- Handlers in the block may contain nested subprograms that require -- unnesting.