public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7853] ada: Fix double finalization in conditional exit statement
@ 2023-09-27  8:23 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-09-27  8:23 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:54a16c276e5a4bb630087651d063a96224e821df

commit r13-7853-g54a16c276e5a4bb630087651d063a96224e821df
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Jan 31 16:04:01 2023 +0100

    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.

Diff:
---
 gcc/ada/exp_ch4.adb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 31823eaeca7..924452c4fb5 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -5651,14 +5651,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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-27  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27  8:23 [gcc r13-7853] ada: Fix double finalization in conditional exit statement Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).