https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114710
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Marc Poulhi?s <d...@gcc.gnu.org>: https://gcc.gnu.org/g:9e490bea69205ec4cad8caf21f19d8a8a89a7b43 commit r15-1260-g9e490bea69205ec4cad8caf21f19d8a8a89a7b43 Author: Eric Botcazou <ebotca...@adacore.com> Date: Mon Apr 22 09:35:44 2024 +0200 ada: Fix too late finalization of temporary object The problem is that Is_Finalizable_Transient returns false when a transient object is subject to a renaming by another transient object present in the same transient scope, thus forcing its finalization to be deferred to the enclosing scope. That's not necessary, as only renamings by nontransient objects serviced by transient scopes need to be rejected by the predicate. The change also removes now dead code in the finalization machinery. gcc/ada/ PR ada/114710 * exp_ch7.adb (Build_Finalizer.Process_Declarations): Remove dead code dealing with renamings. * exp_util.ads (Is_Finalizable_Transient): Rename Rel_Node to N. * exp_util.adb (Is_Finalizable_Transient): Likewise. (Is_Aliased): Remove obsolete code dealing wih EWA nodes and only consider renamings present in N itself. (Requires_Cleanup_Actions): Remove dead code dealing with renamings.