diff options
author | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-10 22:46:39 +0000 |
---|---|---|
committer | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-10 22:46:39 +0000 |
commit | 5f260d20295334c7ccebf7844ff05620a720ecb3 (patch) | |
tree | 3da698f23b9d27cbcac4d67493ad5d4b6dcab477 /gcc/ada/exp_aggr.adb | |
parent | 497a4f03e6e93ebe61f30d0d432b0d90342af7fd (diff) | |
download | gcc-5f260d20295334c7ccebf7844ff05620a720ecb3.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46165 138bc75d-0d04-0410-961f-82ee72b054a4
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 |