From: Eric Botcazou <ebotca...@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_aggr.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 75e5e1402df..c4a016ed3d4 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -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 :=
-- 
2.40.0

Reply via email to