]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix memory leak in multi-dimensional array aggregate of Vector
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 4 Apr 2023 22:03:27 +0000 (00:03 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 29 May 2023 08:23:20 +0000 (10:23 +0200)
It comes from a superfluous adjustment for subarray components.

gcc/ada/

* exp_aggr.adb (Initialize_Array_Component): Fix condition detecting
the nested case that requires an adjustment.

gcc/ada/exp_aggr.adb

index 75e5e1402dff90043873516478efc61757d74ed7..c4a016ed3d4f50182eda52354be7b2890a3ea33f 100644 (file)
@@ -1459,7 +1459,7 @@ package body Exp_Aggr is
               and then not Is_Build_In_Place_Function_Call (Init_Expr)
               and then not
                 (Is_Array_Type (Comp_Typ)
-                  and then Is_Controlled (Component_Type (Comp_Typ))
+                  and then Needs_Finalization (Component_Type (Comp_Typ))
                   and then Nkind (Expr) = N_Aggregate)
             then
                Adj_Call :=