diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-10-02 10:40:05 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-10-02 10:40:05 +0200 |
commit | cb42ba5d667142c60c27fadd8efba35e0e18e797 (patch) | |
tree | 946ac23df94fe9dbd7c7c0d71ada9bf73e8b54f1 | |
parent | 4b1c4f20d84963a47ed6c12ea564488c0b224655 (diff) | |
download | gcc-cb42ba5d667142c60c27fadd8efba35e0e18e797.zip gcc-cb42ba5d667142c60c27fadd8efba35e0e18e797.tar.gz gcc-cb42ba5d667142c60c27fadd8efba35e0e18e797.tar.bz2 |
[multiple changes]
2012-10-02 Robert Dewar <dewar@adacore.com>
* exp_ch4.adb (Expand_N_Op_Expon): Use expression with actions
for x ** 4.
2012-10-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch5.adb: (Analyze_Iterator_Specification): If container
has a variable indexing aspect, the element is a variable and
is modifiable in the loop. This check is also performed when the
loop is expanded, but it must be done in semantic analysis when
expansion is disabled, for example for ASIS usage.
2012-10-02 Ed Schonberg <schonberg@adacore.com>
* lib-xref.adb (Generate_Reference): If a child subprogram
has no previous spec, treat a reference to its formals (such
as a parameter association) as coming from source in order to
generate the proper references and enable gps navigation between
reference and declaration.
From-SVN: r191965
-rw-r--r-- | gcc/ada/ChangeLog | 21 | ||||
-rw-r--r-- | gcc/ada/exp_ch4.adb | 40 | ||||
-rw-r--r-- | gcc/ada/lib-xref.adb | 7 | ||||
-rw-r--r-- | gcc/ada/sem_ch5.adb | 7 |
4 files changed, 59 insertions, 16 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8dd037f..b93836e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,26 @@ 2012-10-02 Robert Dewar <dewar@adacore.com> + * exp_ch4.adb (Expand_N_Op_Expon): Use expression with actions + for x ** 4. + +2012-10-02 Ed Schonberg <schonberg@adacore.com> + + * sem_ch5.adb: (Analyze_Iterator_Specification): If container + has a variable indexing aspect, the element is a variable and + is modifiable in the loop. This check is also performed when the + loop is expanded, but it must be done in semantic analysis when + expansion is disabled, for example for ASIS usage. + +2012-10-02 Ed Schonberg <schonberg@adacore.com> + + * lib-xref.adb (Generate_Reference): If a child subprogram + has no previous spec, treat a reference to its formals (such + as a parameter association) as coming from source in order to + generate the proper references and enable gps navigation between + reference and declaration. + +2012-10-02 Robert Dewar <dewar@adacore.com> + * checks.adb (Apply_Arithmetic_Overflow_Checked_Suppressed): New name for Apply_Arithmetic_Overflow_Normal (Apply_Arithmetic_Overflow_Minimized_Eliminated): diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 560d175..ece60ef 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -7242,11 +7242,11 @@ package body Exp_Ch4 is Exptyp : constant Entity_Id := Etype (Exp); Ovflo : constant Boolean := Do_Overflow_Check (N); Expv : Uint; - Xnode : Node_Id; Temp : Node_Id; Rent : RE_Id; Ent : Entity_Id; Etyp : Entity_Id; + Xnode : Node_Id; begin Binary_Op_Validity_Checks (N); @@ -7301,7 +7301,8 @@ package body Exp_Ch4 is return; end if; - -- Test for case of known right argument + -- Test for case of known right argument where we can replace the + -- exponentiation by an equivalent expression using multiplication. if Compile_Time_Known_Value (Exp) then Expv := Expr_Value (Exp); @@ -7355,27 +7356,34 @@ package body Exp_Ch4 is Right_Opnd => Duplicate_Subexpr_No_Checks (Base)); -- X ** 4 -> + + -- do -- En : constant base'type := base * base; - -- ... + -- in -- En * En - else -- Expv = 4 + else + pragma Assert (Expv = 4); Temp := Make_Temporary (Loc, 'E', Base); - Insert_Actions (N, New_List ( - Make_Object_Declaration (Loc, - Defining_Identifier => Temp, - Constant_Present => True, - Object_Definition => New_Reference_To (Typ, Loc), + Xnode := + Make_Expression_With_Actions (Loc, + Actions => New_List ( + Make_Object_Declaration (Loc, + Defining_Identifier => Temp, + Constant_Present => True, + Object_Definition => New_Reference_To (Typ, Loc), + Expression => + Make_Op_Multiply (Loc, + Left_Opnd => + Duplicate_Subexpr (Base), + Right_Opnd => + Duplicate_Subexpr_No_Checks (Base)))), + Expression => Make_Op_Multiply (Loc, - Left_Opnd => Duplicate_Subexpr (Base), - Right_Opnd => Duplicate_Subexpr_No_Checks (Base))))); - - Xnode := - Make_Op_Multiply (Loc, - Left_Opnd => New_Reference_To (Temp, Loc), - Right_Opnd => New_Reference_To (Temp, Loc)); + Left_Opnd => New_Reference_To (Temp, Loc), + Right_Opnd => New_Reference_To (Temp, Loc))); end if; Rewrite (N, Xnode); diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index bbf1a3d..aa9031f 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -945,6 +945,13 @@ package body Lib.Xref is then Ent := E; + -- Ditto for the formals of such a subprogram + + elsif Is_Overloadable (Scope (E)) + and then Is_Child_Unit (Scope (E)) + then + Ent := E; + -- Record components of discriminated subtypes or derived types must -- be treated as references to the original component. diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index f3df8c5..f756dbc 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -1808,6 +1808,13 @@ package body Sem_Ch5 is return; else Set_Etype (Def_Id, Entity (Element)); + + -- If the container has a variable indexing aspect, the + -- element is a variable and is modifiable in the loop. + + if Present (Find_Aspect (Typ, Aspect_Variable_Indexing)) then + Set_Ekind (Def_Id, E_Variable); + end if; end if; end; |