summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_aggr.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-02 09:26:39 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-02 09:26:39 +0000
commit70eaa03199a944dbe7532101d5802e53c1b3da61 (patch)
tree838d7fdc77b335b755a615851de2e00a2afecea0 /gcc/ada/exp_aggr.adb
parented69568439ca914c385d83b925b4ca9b7e31ced3 (diff)
downloadgcc-70eaa03199a944dbe7532101d5802e53c1b3da61.tar.gz
2015-03-02 Gary Dismukes <dismukes@adacore.com>
* einfo.adb, checks.adb: Minor reformatting and typo fixes. 2015-03-02 Ed Schonberg <schonberg@adacore.com> * exp_aggr.adb (Get_Assoc_Expr): If the Default_Component_Value is defined for the array type, use it instead of a Default_Value specified for the component type itself. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221102 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_aggr.adb')
-rw-r--r--gcc/ada/exp_aggr.adb23
1 files changed, 16 insertions, 7 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index f958c152b6e..2539033fce5 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -786,8 +786,10 @@ package body Exp_Aggr is
-- Otherwise we call Build_Code recursively
function Get_Assoc_Expr (Assoc : Node_Id) return Node_Id;
- -- For an association with a box, use default aspect of component type
- -- if present, to initialize one or more components.
+ -- For an association with a box, use value given by aspect
+ -- Default_Component_Value of array type if specified, else use
+ -- value given by aspect Default_Value for component type itself
+ -- if specified, else return Empty.
function Local_Compile_Time_Known_Value (E : Node_Id) return Boolean;
function Local_Expr_Value (E : Node_Id) return Uint;
@@ -1533,12 +1535,19 @@ package body Exp_Aggr is
--------------------
function Get_Assoc_Expr (Assoc : Node_Id) return Node_Id is
+ Typ : constant Entity_Id := Base_Type (Etype (N));
+
begin
if Box_Present (Assoc) then
- if Is_Scalar_Type (Ctype)
- and then Present (Default_Aspect_Value (Ctype))
- then
- return Default_Aspect_Value (Ctype);
+ 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;
else
return Empty;
end if;