aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch12.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_ch12.adb')
-rw-r--r--gcc/ada/sem_ch12.adb28
1 files changed, 18 insertions, 10 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 5768e28e..1d94780 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -276,6 +276,7 @@ package body Sem_Ch12 is
-- Pre
-- Pre_Class
-- Precondition
+ -- Program_Exit
-- Refined_Depends
-- Refined_Global
-- Refined_Post
@@ -3371,7 +3372,7 @@ package body Sem_Ch12 is
end if;
if Present (E) then
- Preanalyze_Spec_Expression (E, T);
+ Preanalyze_And_Resolve_Spec_Expression (E, T);
-- The default for a ghost generic formal IN parameter of
-- access-to-variable type should be a ghost object (SPARK
@@ -4195,7 +4196,7 @@ package body Sem_Ch12 is
elsif Present (Expr) then
Push_Scope (Nam);
Install_Formals (Nam);
- Preanalyze_Spec_Expression (Expr, Etype (Nam));
+ Preanalyze_And_Resolve_Spec_Expression (Expr, Etype (Nam));
End_Scope;
end if;
@@ -6031,6 +6032,10 @@ package body Sem_Ch12 is
if (Is_In_Main_Unit (N) or else Is_Inlined_Or_Child_Of_Inlined (Subp))
+ -- No need to instantiate bodies in generic units
+
+ and then not Is_Generic_Unit (Cunit_Entity (Main_Unit))
+
-- Must be generating code or analyzing code in GNATprove mode
and then (Operating_Mode = Generate_Code
@@ -9340,9 +9345,6 @@ package body Sem_Ch12 is
and then Nkind (Ancestor_Type (N)) in N_Entity
then
declare
- Root_Typ : constant Entity_Id :=
- Root_Type (Ancestor_Type (N));
-
Typ : Entity_Id := Ancestor_Type (N);
begin
@@ -9351,7 +9353,7 @@ package body Sem_Ch12 is
Switch_View (Typ);
end if;
- exit when Typ = Root_Typ;
+ exit when Etype (Typ) = Typ;
Typ := Etype (Typ);
end loop;
@@ -13034,10 +13036,6 @@ package body Sem_Ch12 is
Make_Defining_Identifier (Sloc (Act_Decl_Id), Chars (Act_Decl_Id));
Preserve_Comes_From_Source (Act_Body_Id, Act_Decl_Id);
- -- Some attributes of spec entity are not inherited by body entity
-
- Set_Handler_Records (Act_Body_Id, No_List);
-
if Nkind (Defining_Unit_Name (Act_Spec)) =
N_Defining_Program_Unit_Name
then
@@ -14132,6 +14130,16 @@ package body Sem_Ch12 is
T2 := Etype (I2);
end if;
+ -- In the case of a fixed-lower-bound subtype, we want to check
+ -- against the index type's range rather than the range of the
+ -- subtype (which will be seen as unconstrained, and whose bounds
+ -- won't generally match those of the formal unconstrained array
+ -- type's corresponding index type).
+
+ if Is_Fixed_Lower_Bound_Index_Subtype (T2) then
+ T2 := Etype (Scalar_Range (T2));
+ end if;
+
if not Subtypes_Match
(Find_Actual_Type (Etype (I1), A_Gen_T), T2)
then