ada: Fix wrong finalization for loop on indexed container
commitdf3480cdb6626759b35d1b2527e3f6a6fc4dcc98
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 7 Apr 2023 17:17:20 +0000 (7 19:17 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 29 May 2023 08:23:22 +0000 (29 10:23 +0200)
treef603f81cd4d1094a25c62156c73427a3c283a1f3
parent47853d3acefbdedfad9ef693a3184093ceaab7fd
ada: Fix wrong finalization for loop on indexed container

The problem is that a transient temporary created for the constant indexing
of the container is finalized almost immediately after its creation.

gcc/ada/

* exp_util.adb (Is_Finalizable_Transient.Is_Indexed_Container):
New predicate to detect a temporary created to hold the result of
a constant indexing on a container.
(Is_Finalizable_Transient.Is_Iterated_Container): Adjust a couple
of obsolete comments.
(Is_Finalizable_Transient): Return False if Is_Indexed_Container
returns True on the object.
gcc/ada/exp_util.adb