diff options
author | Ed Schonberg <schonber@gnat.com> | 2001-10-10 22:46:39 +0000 |
---|---|---|
committer | Geert Bosch <bosch@gcc.gnu.org> | 2001-10-11 00:46:39 +0200 |
commit | c84700e7c77e92776dd951d8ce7e7e1efd0c0464 (patch) | |
tree | 3da698f23b9d27cbcac4d67493ad5d4b6dcab477 /gcc/ada/exp_aggr.adb | |
parent | d8d80dcd6ca6561c46d2724d0724f6ce5a74d6b6 (diff) | |
download | gcc-c84700e7c77e92776dd951d8ce7e7e1efd0c0464.tar.gz |
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_aggr.adb')
-rw-r--r-- | gcc/ada/exp_aggr.adb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 92a7396fd63..e32fe91642e 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- $Revision: 1.170 $ +-- $Revision$ -- -- -- Copyright (C) 1992-2001 Free Software Foundation, Inc. -- -- -- @@ -1136,6 +1136,24 @@ package body Exp_Aggr is High := Add (-1, To => Table (J + 1).Choice_Lo); end if; + -- If this is an expansion within an init_proc, make + -- sure that discriminant references are replaced by + -- the corresponding discriminal. + + if Inside_Init_Proc then + if Is_Entity_Name (Low) + and then Ekind (Entity (Low)) = E_Discriminant + then + Set_Entity (Low, Discriminal (Entity (Low))); + end if; + + if Is_Entity_Name (High) + and then Ekind (Entity (High)) = E_Discriminant + then + Set_Entity (High, Discriminal (Entity (High))); + end if; + end if; + if First or else not Empty_Range (Low, High) then |