diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-30 14:32:24 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-30 14:32:24 +0000 |
commit | a92b003e62dc136a8e9fd5ad12a969e6055ab0da (patch) | |
tree | b1cf07aef5bdb3dcf68a1d943d6495a81c0d1952 /gcc/ada/exp_attr.adb | |
parent | ac07802accadffbc9a2d932c14ad599d8e38fe91 (diff) | |
download | gcc-a92b003e62dc136a8e9fd5ad12a969e6055ab0da.tar.gz |
2014-07-30 Robert Dewar <dewar@adacore.com>
* exp_aggr.adb: Update comments.
* a-chtgbo.adb, a-chtgbo.ads, a-cbhase.adb, a-cbhase.ads: Minor
reformatting.
2014-07-30 Robert Dewar <dewar@adacore.com>
* cstand.adb (New_Standard_Entity): New version takes name
string to call Make_Name.
(Create_Standard): Use this routine to set name before setting other
fields.
2014-07-30 Robert Dewar <dewar@adacore.com>
* exp_attr.adb (Expand_Attribute, case First): Rewrite simple
entity reference.
(Expand_Attribute, case Last): Ditto.
* exp_ch3.adb (Constrain_Index): New calling sequence for
Process_Range_Expr_In_Decl.
(Expand_N_Object_Declaration): Avoid setting Is_Known_Valid in one
problematical case.
* sem_ch3.adb (Constrain_Index): New calling sequence for
Process_Range_Expr_In_Decl.
(Set_Scalar_Range_For_Subtype): ditto.
(Process_Range_Expr_In_Decl): Create constants to hold bounds for
subtype.
* sem_ch3.ads (Process_Range_Expr_In_Decl): Add Subtyp parameter.
* sem_eval.adb (Compile_Time_Compare): Make sure we use base
types if we are not assuming no invalid values.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213286 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_attr.adb')
-rw-r--r-- | gcc/ada/exp_attr.adb | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index f8cfd4ca93a..43051fae1a6 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -2872,11 +2872,28 @@ package body Exp_Attr is Rewrite (N, Make_Attribute_Reference (Loc, Attribute_Name => Name_First, - Prefix => New_Occurrence_Of (Get_Index_Subtype (N), Loc))); + Prefix => + New_Occurrence_Of (Get_Index_Subtype (N), Loc))); Analyze_And_Resolve (N, Typ); + -- For access type, apply access check as needed + elsif Is_Access_Type (Ptyp) then Apply_Access_Check (N); + + -- For scalar type, if low bound is a reference to an entity, just + -- replace with a direct reference. Note that we can only have a + -- reference to a constant entity at this stage, anything else would + -- have already been rewritten. + + elsif Is_Scalar_Type (Ptyp) then + declare + Lo : constant Node_Id := Type_Low_Bound (Ptyp); + begin + if Is_Entity_Name (Lo) then + Rewrite (N, New_Occurrence_Of (Entity (Lo), Loc)); + end if; + end; end if; --------------- @@ -3535,8 +3552,24 @@ package body Exp_Attr is Prefix => New_Occurrence_Of (Get_Index_Subtype (N), Loc))); Analyze_And_Resolve (N, Typ); + -- For access type, apply access check as needed + elsif Is_Access_Type (Ptyp) then Apply_Access_Check (N); + + -- For scalar type, if low bound is a reference to an entity, just + -- replace with a direct reference. Note that we can only have a + -- reference to a constant entity at this stage, anything else would + -- have already been rewritten. + + elsif Is_Scalar_Type (Ptyp) then + declare + Hi : constant Node_Id := Type_High_Bound (Ptyp); + begin + if Is_Entity_Name (Hi) then + Rewrite (N, New_Occurrence_Of (Entity (Hi), Loc)); + end if; + end; end if; -------------- |