]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix too late finalization of temporary object
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 22 Apr 2024 07:35:44 +0000 (09:35 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 13 Jun 2024 13:30:27 +0000 (15:30 +0200)
commit9e490bea69205ec4cad8caf21f19d8a8a89a7b43
tree7f471aaff2525e6d2aa023a0fff3ebe1bdb9df91
parent0690178e66c2fca5e838ada46fa87fa22502f2d7
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.
gcc/ada/exp_ch7.adb
gcc/ada/exp_util.adb
gcc/ada/exp_util.ads