aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch3.adb
diff options
context:
space:
mode:
authorEd Schonberg <schonber@gnat.com>2001-10-10 22:46:39 +0000
committerGeert Bosch <bosch@gcc.gnu.org>2001-10-11 00:46:39 +0200
commitc84700e7c77e92776dd951d8ce7e7e1efd0c0464 (patch)
tree3da698f23b9d27cbcac4d67493ad5d4b6dcab477 /gcc/ada/exp_ch3.adb
parentd8d80dcd6ca6561c46d2724d0724f6ce5a74d6b6 (diff)
downloadgcc-c84700e7c77e92776dd951d8ce7e7e1efd0c0464.zip
gcc-c84700e7c77e92776dd951d8ce7e7e1efd0c0464.tar.gz
gcc-c84700e7c77e92776dd951d8ce7e7e1efd0c0464.tar.bz2
einfo.adb (Write_Field19_Name): Body_Entity is also defined for a generic package.
* einfo.adb (Write_Field19_Name): Body_Entity is also defined for a generic package. * einfo.ads: Body_Entity is also defined for generic package. Documentation change only * exp_aggr.adb (Build_Array_Aggr_Code): When expanding an others_choice for a discriminated component initialization, convert discriminant references into the corresponding discriminals. * exp_ch3.adb (Get_Simple_Init_Val): Add qualification to aggregate only if original type is private and expression has to be wrapped in a conversion. * checks.adb: (Apply_Constraint_Check): Do not perform length check if expression is an aggregate with only an others_choice. (Length_N_Cond): two references to the same in_parameter (typically the discriminal in an init_proc) denote the same value. Two useful optimization uncovered by bugfixes above. From-SVN: r46165
Diffstat (limited to 'gcc/ada/exp_ch3.adb')
-rw-r--r--gcc/ada/exp_ch3.adb28
1 files changed, 13 insertions, 15 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 76520cf..012e254 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- $Revision: 1.481 $
+-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
@@ -4210,20 +4210,14 @@ package body Exp_Ch3 is
then
pragma Assert (Init_Or_Norm_Scalars);
- -- Build aggregate with an explicit qualification, because it
- -- may otherwise be ambiguous in context.
-
return
- Make_Qualified_Expression (Loc,
- Subtype_Mark => New_Occurrence_Of (T, Loc),
- Expression =>
- Make_Aggregate (Loc,
- Component_Associations => New_List (
- Make_Component_Association (Loc,
- Choices => New_List (
- Make_Others_Choice (Loc)),
- Expression =>
- Get_Simple_Init_Val (Component_Type (T), Loc)))));
+ Make_Aggregate (Loc,
+ Component_Associations => New_List (
+ Make_Component_Association (Loc,
+ Choices => New_List (
+ Make_Others_Choice (Loc)),
+ Expression =>
+ Get_Simple_Init_Val (Component_Type (T), Loc))));
-- Access type is initialized to null
@@ -4267,8 +4261,12 @@ package body Exp_Ch3 is
-- A special case, if the underlying value is null, then qualify
-- it with the underlying type, so that the null is properly typed
+ -- Similarly, if it is an aggregate it must be qualified, because
+ -- an unchecked conversion does not provide a context for it.
- if Nkind (Val) = N_Null then
+ if Nkind (Val) = N_Null
+ or else Nkind (Val) = N_Aggregate
+ then
Val :=
Make_Qualified_Expression (Loc,
Subtype_Mark =>