aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog18
-rw-r--r--gcc/ada/gcc-interface/decl.cc8
-rw-r--r--gcc/ada/gen_il-gen-gen_nodes.adb2
-rw-r--r--gcc/ada/gnatvsn.adb7
-rw-r--r--gcc/ada/sem_ch12.adb31
5 files changed, 58 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 6be8962..7f1295f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,21 @@
+2025-03-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnatvsn.adb (Gnat_Free_Software): Fix message formatting.
+
+2025-03-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Record_Subtype>: Set
+ the may_alias attribute if a specific GCC type is built.
+
+2025-03-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gen_il-gen-gen_nodes.adb (N_Formal_Package_Declaration): Use
+ N_Declaration instead of Node_Kind as ancestor.
+ * sem_ch12.adb (Get_Formal_Entity): Remove obsolete alternative.
+ (Instantiate_Formal_Package): Take into account the abbreviated
+ instances in the main loop running over the actuals of the local
+ package created for the formal package.
+
2025-02-04 Eric Botcazou <ebotcazou@adacore.com>
PR ada/118731
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 1854c58..1694b4e 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -3651,6 +3651,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
TYPE_PACKED (gnu_type) = TYPE_PACKED (gnu_base_type);
TYPE_REVERSE_STORAGE_ORDER (gnu_type)
= Reverse_Storage_Order (gnat_entity);
+
+ /* Do the same for subtypes as for the base type, since pointers
+ to them may symmetrically also point to the latter. */
+ prepend_one_attribute
+ (&attr_list, ATTR_MACHINE_ATTRIBUTE,
+ get_identifier ("may_alias"), NULL_TREE,
+ gnat_entity);
+
process_attributes (&gnu_type, &attr_list, true, gnat_entity);
/* Set the size, alignment and alias set of the type to match
diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb
index 1f5dc6d..eb03536 100644
--- a/gcc/ada/gen_il-gen-gen_nodes.adb
+++ b/gcc/ada/gen_il-gen-gen_nodes.adb
@@ -1309,7 +1309,7 @@ begin -- Gen_IL.Gen.Gen_Nodes
Cc (N_Formal_Modular_Type_Definition, Node_Kind);
Cc (N_Formal_Ordinary_Fixed_Point_Definition, Node_Kind);
- Cc (N_Formal_Package_Declaration, Node_Kind,
+ Cc (N_Formal_Package_Declaration, N_Declaration,
(Sy (Defining_Identifier, Node_Id),
Sy (Name, Node_Id, Default_Empty),
Sy (Generic_Associations, List_Id, Default_No_List),
diff --git a/gcc/ada/gnatvsn.adb b/gcc/ada/gnatvsn.adb
index 5b7b4fb..58f8a1a 100644
--- a/gcc/ada/gnatvsn.adb
+++ b/gcc/ada/gnatvsn.adb
@@ -41,10 +41,11 @@ package body Gnatvsn is
function Gnat_Free_Software return String is
begin
return
- "This is free software; see the source for copying conditions." &
+ "This is free software; see the source for copying conditions. " &
+ "There is NO" &
ASCII.LF &
- "There is NO warranty; not even for MERCHANTABILITY or FITNESS" &
- " FOR A PARTICULAR PURPOSE.";
+ "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR " &
+ "PURPOSE.";
end Gnat_Free_Software;
type char_array is array (Natural range <>) of aliased Character;
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index dad8c73..5768e28e 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -11551,6 +11551,7 @@ package body Sem_Ch12 is
function Get_Formal_Entity (N : Node_Id) return Entity_Id is
Kind : constant Node_Kind := Nkind (Original_Node (N));
+
begin
case Kind is
when N_Formal_Object_Declaration =>
@@ -11565,9 +11566,6 @@ package body Sem_Ch12 is
when N_Formal_Package_Declaration =>
return Defining_Identifier (Original_Node (N));
- when N_Generic_Package_Declaration =>
- return Defining_Identifier (Original_Node (N));
-
-- All other declarations are introduced by semantic analysis and
-- have no match in the actual.
@@ -11806,6 +11804,26 @@ package body Sem_Ch12 is
end if;
Next_Non_Pragma (Formal_Node);
+
+ -- If the actual of the local package created for the formal
+ -- is itself an instantiated formal package, then it could
+ -- have given rise to additional declarations, see the code
+ -- dealing with conformance checking below.
+
+ if Nkind (Actual_Of_Formal) = N_Package_Renaming_Declaration
+ and then Requires_Conformance_Checking
+ (Declaration_Node
+ (Associated_Formal_Package
+ (Defining_Entity (Actual_Of_Formal))))
+ then
+ Next (Actual_Of_Formal);
+ pragma Assert
+ (Nkind (Actual_Of_Formal) = N_Package_Declaration);
+ Next (Actual_Of_Formal);
+ pragma Assert
+ (Nkind (Actual_Of_Formal) = N_Package_Instantiation);
+ end if;
+
Next (Actual_Of_Formal);
-- A formal subprogram may be overloaded, so advance in
@@ -11861,10 +11879,15 @@ package body Sem_Ch12 is
-- checking, because it contains formal declarations for those
-- defaulted parameters, and those should not reach the back-end.
+ -- This processing needs to be synchronized with the pattern matching
+ -- done in the main loop of the above block that starts with the test
+ -- on Requires_Conformance_Checking.
+
if Requires_Conformance_Checking (Formal) then
declare
I_Pack : constant Entity_Id := Make_Temporary (Loc, 'P');
- I_Nam : Node_Id;
+ I_Nam : Node_Id;
+
begin
Set_Is_Internal (I_Pack);
Mutate_Ekind (I_Pack, E_Package);