public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6367] [Ada] More default initialization for multi-dim array aggregates
@ 2022-01-07 16:28 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-01-07 16:28 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d7b2fad2ec6652194aab0b9acfd41f187c4396d0

commit r12-6367-gd7b2fad2ec6652194aab0b9acfd41f187c4396d0
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Tue Dec 21 15:20:30 2021 +0100

    [Ada] More default initialization for multi-dim array aggregates
    
    gcc/ada/
    
            * exp_aggr.adb (Gen_Assign): Remove explicit initialization for
            components of access types.
            (Get_Assoc_Expr): Enable initialization for components of all
            types that require simple initialization.

Diff:
---
 gcc/ada/exp_aggr.adb | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 89f2ce65338..4dfe280fe61 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -1872,12 +1872,6 @@ package body Exp_Aggr is
                   Set_Etype (Indexed_Comp, Ctype);
                   Append_To (Stmts, Make_Invariant_Call (Indexed_Comp));
                end if;
-
-            elsif Is_Access_Type (Ctype) then
-               Append_To (Stmts,
-                 Make_Assignment_Statement (Loc,
-                   Name       => New_Copy_Tree (Indexed_Comp),
-                   Expression => Make_Null (Loc)));
             end if;
 
             if Needs_Finalization (Ctype) then
@@ -2212,15 +2206,10 @@ package body Exp_Aggr is
 
       begin
          if Box_Present (Assoc) then
-            if Is_Scalar_Type (Ctype) then
-               if Present (Default_Aspect_Component_Value (Typ)) then
-                  return Default_Aspect_Component_Value (Typ);
-               elsif Present (Default_Aspect_Value (Ctype)) then
-                  return Default_Aspect_Value (Ctype);
-               else
-                  return Empty;
-               end if;
-
+            if Present (Default_Aspect_Component_Value (Typ)) then
+               return Default_Aspect_Component_Value (Typ);
+            elsif Needs_Simple_Initialization (Ctype) then
+               return Get_Simple_Init_Val (Ctype, N);
             else
                return Empty;
             end if;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-07 16:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 16:28 [gcc r12-6367] [Ada] More default initialization for multi-dim array aggregates Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).