For aggregate components that are aggregates the frontend has been
enhanced to evaluate if the inner aggregate depends on the variable
being assigned to. This enhancement allows the compiler to avoid the
generation of a temporary and thus generate better code for large nested
aggregates.

Tested on x86_64-pc-linux-gnu, committed on trunk

2020-06-08  Javier Miranda  <mira...@adacore.com>

gcc/ada/

        * exp_aggr.adb (Safe_Component): Remove code that considers as
        unsafe components that are aggregates; such removal allows the
        frontend to proceed and evaluate if they are safe by means of
        invoking Safe_Aggregate.
--- gcc/ada/exp_aggr.adb
+++ gcc/ada/exp_aggr.adb
@@ -4283,11 +4283,6 @@ package body Exp_Aggr is
             if Is_Overloaded (Expr) then
                return False;
 
-            elsif Nkind (Expr) = N_Aggregate
-               and then not Is_Others_Aggregate (Expr)
-            then
-               return False;
-
             elsif Nkind (Expr) = N_Allocator then
 
                --  For now, too complex to analyze

Reply via email to