aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-06-17 10:56:40 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-06-17 10:56:40 +0200
commitbce79204fbd55ec8f622979e582752e44498c76c (patch)
tree592d50ba4c49a4ad6785726c1fbee9a23c1aba1a
parent3428cb9fcb371855b04fd7b796cd98819a31047d (diff)
downloadgcc-bce79204fbd55ec8f622979e582752e44498c76c.zip
gcc-bce79204fbd55ec8f622979e582752e44498c76c.tar.gz
gcc-bce79204fbd55ec8f622979e582752e44498c76c.tar.bz2
[multiple changes]
2010-06-17 Robert Dewar <dewar@adacore.com> * einfo.adb: Minor code fix, allow E_Class_Wide_Type for Equivalent_Type to match documentation. 2010-06-17 Robert Dewar <dewar@adacore.com> * sem_ch6.adb, sem_ch7.adb: Minor reformatting. * sem_ch3.adb, sem_ch5.adb, sem_ch9.adb, sem_ch10.adb, sem_ch12.adb, sem_ch4.adb, sem_ch8.adb, sem_ch13.adb: Make use of Ekind_In. 2010-06-17 Thomas Quinot <quinot@adacore.com> * sem_res.adb (Set_Slice_Subtype): Always freeze the slice's itype. 2010-06-17 Thomas Quinot <quinot@adacore.com> * freeze.adb (Freeze_Expression): Short circuit operators are valid freeze node insertion points. From-SVN: r160889
-rw-r--r--gcc/ada/ChangeLog20
-rw-r--r--gcc/ada/einfo.adb7
-rw-r--r--gcc/ada/freeze.adb6
-rw-r--r--gcc/ada/sem_ch10.adb9
-rw-r--r--gcc/ada/sem_ch12.adb18
-rw-r--r--gcc/ada/sem_ch13.adb31
-rw-r--r--gcc/ada/sem_ch3.adb42
-rw-r--r--gcc/ada/sem_ch4.adb29
-rw-r--r--gcc/ada/sem_ch5.adb8
-rw-r--r--gcc/ada/sem_ch6.adb2
-rw-r--r--gcc/ada/sem_ch7.adb2
-rw-r--r--gcc/ada/sem_ch8.adb21
-rw-r--r--gcc/ada/sem_ch9.adb13
-rw-r--r--gcc/ada/sem_res.adb22
14 files changed, 104 insertions, 126 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index da0a9db..2a2e298 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,25 @@
2010-06-17 Robert Dewar <dewar@adacore.com>
+ * einfo.adb: Minor code fix, allow E_Class_Wide_Type for
+ Equivalent_Type to match documentation.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch6.adb, sem_ch7.adb: Minor reformatting.
+ * sem_ch3.adb, sem_ch5.adb, sem_ch9.adb, sem_ch10.adb, sem_ch12.adb,
+ sem_ch4.adb, sem_ch8.adb, sem_ch13.adb: Make use of Ekind_In.
+
+2010-06-17 Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb (Set_Slice_Subtype): Always freeze the slice's itype.
+
+2010-06-17 Thomas Quinot <quinot@adacore.com>
+
+ * freeze.adb (Freeze_Expression): Short circuit operators are valid
+ freeze node insertion points.
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
* switch-c.ads, switch-c.adb, sem_ch13.adb: Minor reformatting.
* sem_ch12.adb: Add pragmas Assert and Check to previous change.
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
index c3edd69..7b20078 100644
--- a/gcc/ada/einfo.adb
+++ b/gcc/ada/einfo.adb
@@ -975,7 +975,8 @@ package body Einfo is
function Equivalent_Type (Id : E) return E is
begin
pragma Assert
- (Ekind_In (Id, E_Class_Wide_Subtype,
+ (Ekind_In (Id, E_Class_Wide_Type,
+ E_Class_Wide_Subtype,
E_Access_Protected_Subprogram_Type,
E_Anonymous_Access_Protected_Subprogram_Type,
E_Access_Subprogram_Type,
@@ -7872,10 +7873,10 @@ package body Einfo is
Write_Str ("Spec_PPC_List");
when E_Record_Type =>
- Write_Str ("Underlying record view");
+ Write_Str ("Underlying_Record_View");
when E_Variable | E_Constant =>
- Write_Str ("Related expression");
+ Write_Str ("Related_Expression");
when others =>
Write_Str ("???");
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index e29904f..47befcd 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -4244,8 +4244,8 @@ package body Freeze is
-- exiting from the loop when it is appropriate to insert the freeze
-- node before the current node P.
- -- Also checks som special exceptions to the freezing rules. These cases
- -- result in a direct return, bypassing the freeze action.
+ -- Also checks some special exceptions to the freezing rules. These
+ -- cases result in a direct return, bypassing the freeze action.
P := N;
loop
@@ -4422,6 +4422,8 @@ package body Freeze is
N_Entry_Call_Alternative |
N_Triggering_Alternative |
N_Abortable_Part |
+ N_And_Then |
+ N_Or_Else |
N_Freeze_Entity =>
exit when Is_List_Member (P);
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 8a53d58..ec6dcac 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -5535,9 +5535,7 @@ package body Sem_Ch10 is
then
return True;
- elsif Ekind (E) = E_Generic_Function
- or else Ekind (E) = E_Generic_Procedure
- then
+ elsif Ekind_In (E, E_Generic_Function, E_Generic_Procedure) then
return True;
elsif Ekind (E) = E_Generic_Package
@@ -5578,10 +5576,7 @@ package body Sem_Ch10 is
then
Set_Body_Needed_For_SAL (Unit_Name);
- elsif Ekind (Unit_Name) = E_Generic_Procedure
- or else
- Ekind (Unit_Name) = E_Generic_Function
- then
+ elsif Ekind_In (Unit_Name, E_Generic_Procedure, E_Generic_Function) then
Set_Body_Needed_For_SAL (Unit_Name);
elsif Is_Subprogram (Unit_Name)
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 80ed051..d03ca93 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -2414,8 +2414,8 @@ package body Sem_Ch12 is
end if;
elsif Nkind (Prefix (Def)) = N_Selected_Component then
- if Ekind (Entity (Selector_Name (Prefix (Def))))
- /= E_Entry_Family
+ if Ekind (Entity (Selector_Name (Prefix (Def)))) /=
+ E_Entry_Family
then
Error_Msg_N ("expect valid subprogram name as default", Def);
end if;
@@ -4078,9 +4078,7 @@ package body Sem_Ch12 is
-- Verify that it is a generic subprogram of the right kind, and that
-- it does not lead to a circular instantiation.
- if Ekind (Gen_Unit) /= E_Generic_Procedure
- and then Ekind (Gen_Unit) /= E_Generic_Function
- then
+ if not Ekind_In (Gen_Unit, E_Generic_Procedure, E_Generic_Function) then
Error_Msg_N ("expect generic subprogram in instantiation", Gen_Id);
elsif In_Open_Scopes (Gen_Unit) then
@@ -9860,9 +9858,7 @@ package body Sem_Ch12 is
-- then so far the subprograms correspond, so
-- now check that any result types correspond.
- if No (Anc_Formal)
- and then No (Act_Formal)
- then
+ if No (Anc_Formal) and then No (Act_Formal) then
Subprograms_Correspond := True;
if Ekind (Act_Subp) = E_Function then
@@ -11293,9 +11289,9 @@ package body Sem_Ch12 is
-- exchanged explicitly now, in order to remain consistent with the
-- view of the parent type.
- if Ekind (Typ) = E_Private_Type
- or else Ekind (Typ) = E_Limited_Private_Type
- or else Ekind (Typ) = E_Record_Type_With_Private
+ if Ekind_In (Typ, E_Private_Type,
+ E_Limited_Private_Type,
+ E_Record_Type_With_Private)
then
Dep_Elmt := First_Elmt (Private_Dependents (Typ));
while Present (Dep_Elmt) loop
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index fa66b46..8d5cb08 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -803,9 +803,7 @@ package body Sem_Ch13 is
-- it imported.
if Ignore_Rep_Clauses then
- if Ekind (U_Ent) = E_Variable
- or else Ekind (U_Ent) = E_Constant
- then
+ if Ekind_In (U_Ent, E_Variable, E_Constant) then
Record_Rep_Item (U_Ent, N);
end if;
@@ -1534,8 +1532,8 @@ package body Sem_Ch13 is
Nam);
return;
- elsif Ekind (U_Ent) /= E_Access_Type
- and then Ekind (U_Ent) /= E_General_Access_Type
+ elsif not
+ Ekind_In (U_Ent, E_Access_Type, E_General_Access_Type)
then
Error_Msg_N
("storage pool can only be given for access types", Nam);
@@ -2402,10 +2400,7 @@ package body Sem_Ch13 is
Parent_Last_Bit := UI_From_Int (System_Address_Size - 1);
Pcomp := First_Entity (Tagged_Parent);
while Present (Pcomp) loop
- if Ekind (Pcomp) = E_Discriminant
- or else
- Ekind (Pcomp) = E_Component
- then
+ if Ekind_In (Pcomp, E_Discriminant, E_Component) then
if Component_Bit_Offset (Pcomp) /= No_Uint
and then Known_Static_Esize (Pcomp)
then
@@ -2820,9 +2815,7 @@ package body Sem_Ch13 is
-- This latter test is repeated recursively up the variant tree.
Main_Component_Loop : while Present (C1_Ent) loop
- if Ekind (C1_Ent) /= E_Component
- and then Ekind (C1_Ent) /= E_Discriminant
- then
+ if not Ekind_In (C1_Ent, E_Component, E_Discriminant) then
goto Continue_Main_Component_Loop;
end if;
@@ -3208,11 +3201,8 @@ package body Sem_Ch13 is
-- Otherwise look at the identifier and see if it is OK
- if Ekind (Ent) = E_Named_Integer
- or else
- Ekind (Ent) = E_Named_Real
- or else
- Is_Type (Ent)
+ if Ekind_In (Ent, E_Named_Integer, E_Named_Real)
+ or else Is_Type (Ent)
then
return;
@@ -3884,9 +3874,10 @@ package body Sem_Ch13 is
Out_Present => Out_P,
Parameter_Type => T_Ref));
- Spec := Make_Procedure_Specification (Loc,
- Defining_Unit_Name => Subp_Id,
- Parameter_Specifications => Formals);
+ Spec :=
+ Make_Procedure_Specification (Loc,
+ Defining_Unit_Name => Subp_Id,
+ Parameter_Specifications => Formals);
end if;
return Spec;
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 9245d2d..80e3098 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -3285,9 +3285,7 @@ package body Sem_Ch3 is
("parent of type extension must be a tagged type ", Indic);
return;
- elsif Ekind (Parent_Type) = E_Void
- or else Ekind (Parent_Type) = E_Incomplete_Type
- then
+ elsif Ekind_In (Parent_Type, E_Void, E_Incomplete_Type) then
Error_Msg_N ("premature derivation of incomplete type", Indic);
return;
@@ -7548,9 +7546,7 @@ package body Sem_Ch3 is
begin
D := First_Entity (Derived_Type);
while Present (D) loop
- if Ekind (D) = E_Discriminant
- or else Ekind (D) = E_Component
- then
+ if Ekind_In (D, E_Discriminant, E_Component) then
if Is_Itype (Etype (D))
and then Ekind (Etype (D)) = E_Anonymous_Access_Type
then
@@ -8741,9 +8737,7 @@ package body Sem_Ch3 is
begin
if not Comes_From_Source (E) then
- if Ekind (E) = E_Task_Type
- or else Ekind (E) = E_Protected_Type
- then
+ if Ekind_In (E, E_Task_Type, E_Protected_Type) then
-- It may be an anonymous protected type created for a
-- single variable. Post error on variable, if present.
@@ -9834,9 +9828,10 @@ package body Sem_Ch3 is
& " must be in private part", N);
elsif Ekind (Current_Scope) = E_Package
- and then List_Containing (Parent (Prev))
- /= Visible_Declarations
- (Specification (Unit_Declaration_Node (Current_Scope)))
+ and then
+ List_Containing (Parent (Prev)) /=
+ Visible_Declarations
+ (Specification (Unit_Declaration_Node (Current_Scope)))
then
Error_Msg_N
("deferred constant must be declared in visible part",
@@ -13363,9 +13358,7 @@ package body Sem_Ch3 is
-- Check for early use of incomplete or private type
- if Ekind (Parent_Type) = E_Void
- or else Ekind (Parent_Type) = E_Incomplete_Type
- then
+ if Ekind_In (Parent_Type, E_Void, E_Incomplete_Type) then
Error_Msg_N ("premature derivation of incomplete type", Indic);
return;
@@ -14786,8 +14779,8 @@ package body Sem_Ch3 is
then
null;
- elsif Ekind (Derived_Base) = E_Private_Type
- or else Ekind (Derived_Base) = E_Limited_Private_Type
+ elsif Ekind_In (Derived_Base, E_Private_Type,
+ E_Limited_Private_Type)
then
null;
@@ -14955,9 +14948,7 @@ package body Sem_Ch3 is
-- Start of processing for Is_Visible_Component
begin
- if Ekind (C) = E_Component
- or else Ekind (C) = E_Discriminant
- then
+ if Ekind_In (C, E_Component, E_Discriminant) then
Original_Comp := Original_Record_Component (C);
end if;
@@ -16492,9 +16483,9 @@ package body Sem_Ch3 is
while Present (Priv_Elmt) loop
Priv := Node (Priv_Elmt);
- if Ekind (Priv) = E_Private_Subtype
- or else Ekind (Priv) = E_Limited_Private_Subtype
- or else Ekind (Priv) = E_Record_Subtype_With_Private
+ if Ekind_In (Priv, E_Private_Subtype,
+ E_Limited_Private_Subtype,
+ E_Record_Subtype_With_Private)
then
Full := Make_Defining_Identifier (Sloc (Priv), Chars (Priv));
Set_Is_Itype (Full);
@@ -16642,10 +16633,7 @@ package body Sem_Ch3 is
Prim := Next_Entity (Full_T);
while Present (Prim) and then Prim /= Priv_T loop
- if Ekind (Prim) = E_Procedure
- or else
- Ekind (Prim) = E_Function
- then
+ if Ekind_In (Prim, E_Procedure, E_Function) then
Disp_Typ := Find_Dispatching_Type (Prim);
if Disp_Typ = Full_T
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 126b003..6afb4a1 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -818,10 +818,10 @@ package body Sem_Ch4 is
elsif Nkind (Nam) = N_Selected_Component then
Nam_Ent := Entity (Selector_Name (Nam));
- if Ekind (Nam_Ent) /= E_Entry
- and then Ekind (Nam_Ent) /= E_Entry_Family
- and then Ekind (Nam_Ent) /= E_Function
- and then Ekind (Nam_Ent) /= E_Procedure
+ if not Ekind_In (Nam_Ent, E_Entry,
+ E_Entry_Family,
+ E_Function,
+ E_Procedure)
then
Error_Msg_N ("name in call is not a callable entity", Nam);
Set_Etype (N, Any_Type);
@@ -1174,7 +1174,6 @@ package body Sem_Ch4 is
if Present (Op_Id) then
if Ekind (Op_Id) = E_Operator then
-
LT := Base_Type (Etype (L));
RT := Base_Type (Etype (R));
@@ -1944,7 +1943,8 @@ package body Sem_Ch4 is
elsif Ekind (Etype (P)) = E_Subprogram_Type
or else (Is_Access_Type (Etype (P))
and then
- Ekind (Designated_Type (Etype (P))) = E_Subprogram_Type)
+ Ekind (Designated_Type (Etype (P))) =
+ E_Subprogram_Type)
then
-- Call to access_to-subprogram with possible implicit dereference
@@ -1969,7 +1969,7 @@ package body Sem_Ch4 is
if Ekind (P_T) = E_Subprogram_Type
or else (Is_Access_Type (P_T)
and then
- Ekind (Designated_Type (P_T)) = E_Subprogram_Type)
+ Ekind (Designated_Type (P_T)) = E_Subprogram_Type)
then
Process_Function_Call;
@@ -3580,10 +3580,8 @@ package body Sem_Ch4 is
Has_Candidate := True;
end if;
- elsif Ekind (Comp) = E_Discriminant
- or else Ekind (Comp) = E_Entry_Family
- or else (In_Scope
- and then Is_Entity_Name (Name))
+ elsif Ekind_In (Comp, E_Discriminant, E_Entry_Family)
+ or else (In_Scope and then Is_Entity_Name (Name))
then
Set_Entity_With_Style_Check (Sel, Comp);
Generate_Reference (Comp, Sel);
@@ -4502,9 +4500,7 @@ package body Sem_Ch4 is
if Nkind (N) = N_Function_Call then
Get_First_Interp (Nam, X, It);
while Present (It.Nam) loop
- if Ekind (It.Nam) = E_Function
- or else Ekind (It.Nam) = E_Operator
- then
+ if Ekind_In (It.Nam, E_Function, E_Operator) then
return;
else
Get_Next_Interp (X, It);
@@ -6675,9 +6671,8 @@ package body Sem_Ch4 is
if Is_Derived_Type (T) then
return Primitive_Operations (T);
- elsif Ekind (Scope (T)) = E_Procedure
- or else Ekind (Scope (T)) = E_Function
- then
+ elsif Ekind_In (Scope (T), E_Procedure, E_Function) then
+
-- Scan the list of generic formals to find subprograms
-- that may have a first controlling formal of the type.
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 57bd1b4..1ad9400 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -998,11 +998,9 @@ package body Sem_Ch5 is
if Is_Entity_Name (Exp) then
Ent := Entity (Exp);
- if Ekind (Ent) = E_Variable
- or else
- Ekind (Ent) = E_In_Out_Parameter
- or else
- Ekind (Ent) = E_Out_Parameter
+ if Ekind_In (Ent, E_Variable,
+ E_In_Out_Parameter,
+ E_Out_Parameter)
then
if List_Length (Choices) = 1
and then Nkind (First (Choices)) in N_Subexpr
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index befa1d4..ba3967a 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -3125,6 +3125,7 @@ package body Sem_Ch6 is
or else Is_Child_Unit (S)
then
return False;
+
elsif Ekind (S) = E_Package
and then Has_Forward_Instantiation (S)
then
@@ -6513,7 +6514,6 @@ package body Sem_Ch6 is
-- instance of) a generic type.
Formal := First_Formal (Prev_E);
-
while Present (Formal) loop
F_Typ := Base_Type (Etype (Formal));
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index ca5b18a..11736d5 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -2074,7 +2074,7 @@ package body Sem_Ch7 is
-- but the formals are private and remain so.
if Ekind (Id) = E_Function
- and then Is_Operator_Symbol_Name (Chars (Id))
+ and then Is_Operator_Symbol_Name (Chars (Id))
and then not Is_Hidden (Id)
and then not Error_Posted (Id)
then
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index c10ab2b..b952755 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -1315,7 +1315,8 @@ package body Sem_Ch8 is
begin
if not Is_Overloaded (P) then
if Ekind (Etype (Nam)) /= E_Subprogram_Type
- or else not Type_Conformant (Etype (Nam), New_S) then
+ or else not Type_Conformant (Etype (Nam), New_S)
+ then
Error_Msg_N ("designated type does not match specification", P);
else
Resolve (P);
@@ -1330,8 +1331,8 @@ package body Sem_Ch8 is
while Present (It.Nam) loop
if Ekind (It.Nam) = E_Subprogram_Type
- and then Type_Conformant (It.Nam, New_S) then
-
+ and then Type_Conformant (It.Nam, New_S)
+ then
if Typ /= Any_Id then
Error_Msg_N ("ambiguous renaming", P);
return;
@@ -2149,9 +2150,7 @@ package body Sem_Ch8 is
-- Guard against previous errors, and omit renamings of predefined
-- operators.
- elsif Ekind (Old_S) /= E_Function
- and then Ekind (Old_S) /= E_Procedure
- then
+ elsif not Ekind_In (Old_S, E_Function, E_Procedure) then
null;
elsif Requires_Overriding (Old_S)
@@ -4755,9 +4754,9 @@ package body Sem_Ch8 is
exit when S = Standard_Standard;
- if Ekind (S) = E_Function
- or else Ekind (S) = E_Package
- or else Ekind (S) = E_Procedure
+ if Ekind_In (S, E_Function,
+ E_Package,
+ E_Procedure)
then
P := Generic_Parent (Specification
(Unit_Declaration_Node (S)));
@@ -6223,9 +6222,7 @@ package body Sem_Ch8 is
Next_Formal (Old_F);
end loop;
- if Ekind (Old_S) = E_Function
- or else Ekind (Old_S) = E_Enumeration_Literal
- then
+ if Ekind_In (Old_S, E_Function, E_Enumeration_Literal) then
Set_Etype (New_S, Etype (Old_S));
end if;
end if;
diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index 9a242d5..bcd42d1 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -1174,9 +1174,7 @@ package body Sem_Ch9 is
E := First_Entity (Current_Scope);
while Present (E) loop
- if Ekind (E) = E_Function
- or else Ekind (E) = E_Procedure
- then
+ if Ekind_In (E, E_Function, E_Procedure) then
Set_Convention (E, Convention_Protected);
elsif Is_Task_Type (Etype (E))
@@ -1343,9 +1341,7 @@ package body Sem_Ch9 is
Enclosing := Scope_Stack.Table (J).Entity;
exit when Is_Entry (Enclosing);
- if Ekind (Enclosing) /= E_Block
- and then Ekind (Enclosing) /= E_Loop
- then
+ if not Ekind_In (Enclosing, E_Block, E_Loop) then
Error_Msg_N ("requeue must appear within accept or entry body", N);
return;
end if;
@@ -1576,10 +1572,7 @@ package body Sem_Ch9 is
-- perform an unconditional goto so that any further
-- references will not occur anyway.
- if Ekind (Ent) = E_Out_Parameter
- or else
- Ekind (Ent) = E_In_Out_Parameter
- then
+ if Ekind_In (Ent, E_Out_Parameter, E_In_Out_Parameter) then
Set_Never_Set_In_Source (Ent, False);
Set_Is_True_Constant (Ent, False);
end if;
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 0e23492..eba43ef 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -8958,6 +8958,15 @@ package body Sem_Res is
Set_Etype (Index_Subtype, Index_Type);
Set_Size_Info (Index_Subtype, Index_Type);
Set_RM_Size (Index_Subtype, RM_Size (Index_Type));
+
+ -- Now replace the discrete range in the slice with a reference to
+ -- its index subtype. This ensures that further expansion (e.g
+ -- while rewriting a slice assignment into a FOR loop) does not
+ -- attempt to remove side effects on the bounds again (which would
+ -- cause the bounds in the index subtype definition to refer to
+ -- temporaries before they are defined).
+
+ Set_Discrete_Range (N, New_Copy_Tree (Drange));
end if;
Slice_Subtype := Create_Itype (E_Array_Subtype, N);
@@ -8970,8 +8979,6 @@ package body Sem_Res is
Set_Etype (Slice_Subtype, Base_Type (Etype (N)));
Set_Is_Constrained (Slice_Subtype, True);
- Check_Compile_Time_Size (Slice_Subtype);
-
-- The Etype of the existing Slice node is reset to this slice subtype.
-- Its bounds are obtained from its first index.
@@ -8979,15 +8986,10 @@ package body Sem_Res is
-- In the packed case, this must be immediately frozen
- -- Couldn't we always freeze here??? and if we did, then the above
- -- call to Check_Compile_Time_Size could be eliminated, which would
- -- be nice, because then that routine could be made private to Freeze.
+ -- Always freeze subtype. This ensures that the slice subtype is
+ -- elaborated in the scope of the expression.
- -- Why the test for In_Spec_Expression here ???
-
- if Is_Packed (Slice_Subtype) and not In_Spec_Expression then
- Freeze_Itype (Slice_Subtype, N);
- end if;
+ Freeze_Itype (Slice_Subtype, N);
end Set_Slice_Subtype;