aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-01-31 16:04:01 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-05-22 10:44:08 +0200
commit60498ae3a06ba9a08cd2bf4a851e01e7e6fb1557 (patch)
treef5a500197e6a20ba0977e6e2a6fe26f44650801a /gcc
parent5105de335368f88cb75acbc9bd30984bd49469c1 (diff)
downloadgcc-60498ae3a06ba9a08cd2bf4a851e01e7e6fb1557.zip
gcc-60498ae3a06ba9a08cd2bf4a851e01e7e6fb1557.tar.gz
gcc-60498ae3a06ba9a08cd2bf4a851e01e7e6fb1557.tar.bz2
ada: Fix double finalization in conditional exit statement
The temporary is first finalized through its enclosing block. gcc/ada/ * exp_ch4.adb (Expand_N_Expression_With_Actions.Process_Action): Do not look into nested blocks.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_ch4.adb7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 95b81fb..b63e4733 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -5653,14 +5653,17 @@ package body Exp_Ch4 is
return Skip;
-- Avoid processing temporary function results multiple times when
- -- dealing with nested expression_with_actions.
+ -- dealing with nested expression_with_actions or nested blocks.
-- Similarly, do not process temporary function results in loops.
-- This is done by Expand_N_Loop_Statement and Build_Finalizer.
-- Note that we used to wrongly return Abandon instead of Skip here:
-- this is wrong since it means that we were ignoring lots of
-- relevant subsequent statements.
- elsif Nkind (Act) in N_Expression_With_Actions | N_Loop_Statement then
+ elsif Nkind (Act) in N_Expression_With_Actions
+ | N_Block_Statement
+ | N_Loop_Statement
+ then
return Skip;
end if;