aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2024-07-30 23:08:17 +0000
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-08-08 16:28:29 +0200
commit85f2ffd80ed7a54f36a9bb3a91ee07b2d5e23970 (patch)
treec5c76ca4bb1649ec85283222268c5cac7211767a
parent352d1478bc001d8818e2a7bcecb729d329104ca3 (diff)
downloadgcc-85f2ffd80ed7a54f36a9bb3a91ee07b2d5e23970.zip
gcc-85f2ffd80ed7a54f36a9bb3a91ee07b2d5e23970.tar.gz
gcc-85f2ffd80ed7a54f36a9bb3a91ee07b2d5e23970.tar.bz2
ada: Run-time error with GNAT-LLVM on container aggregate with finalization
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.
-rw-r--r--gcc/ada/exp_ch7.adb3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 72f0b53..640ad5c 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.