aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/libgnat/a-cborse.adb17
-rw-r--r--gcc/ada/libgnat/a-cborse.ads3
-rw-r--r--gcc/ada/libgnat/a-ciorse.adb16
-rw-r--r--gcc/ada/libgnat/a-ciorse.ads3
-rw-r--r--gcc/ada/libgnat/a-coorse.adb16
-rw-r--r--gcc/ada/libgnat/a-coorse.ads3
-rw-r--r--gcc/ada/sem_util.adb6
7 files changed, 61 insertions, 3 deletions
diff --git a/gcc/ada/libgnat/a-cborse.adb b/gcc/ada/libgnat/a-cborse.adb
index b649c5e..9d2a021 100644
--- a/gcc/ada/libgnat/a-cborse.adb
+++ b/gcc/ada/libgnat/a-cborse.adb
@@ -40,6 +40,8 @@ with Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations;
pragma Elaborate_All
(Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations);
+with Ada.Unchecked_Deallocation;
+
with System; use type System.Address;
with System.Put_Images;
@@ -775,6 +777,18 @@ is
Is_Less_Key_Node => Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
+ ------------
+ -- Adjust --
+ ------------
+
+ procedure Adjust (Control : in out Reference_Control_Type) is
+ begin
+ Impl.Reference_Control_Type (Control).Adjust;
+ if Control.Old_Key /= null then
+ Control.Old_Key := new Key_Type'(Control.Old_Key.all);
+ end if;
+ end Adjust;
+
-------------
-- Ceiling --
-------------
@@ -872,6 +886,8 @@ is
--------------
procedure Finalize (Control : in out Reference_Control_Type) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation (Key_Type, Key_Access);
begin
if Control.Container /= null then
Impl.Reference_Control_Type (Control).Finalize;
@@ -883,6 +899,7 @@ is
end if;
Control.Container := null;
+ Deallocate (Control.Old_Key);
end if;
end Finalize;
diff --git a/gcc/ada/libgnat/a-cborse.ads b/gcc/ada/libgnat/a-cborse.ads
index 2366d1a..650f4a4 100644
--- a/gcc/ada/libgnat/a-cborse.ads
+++ b/gcc/ada/libgnat/a-cborse.ads
@@ -324,6 +324,9 @@ is
Old_Key : Key_Access;
end record;
+ overriding procedure Adjust (Control : in out Reference_Control_Type);
+ pragma Inline (Adjust);
+
overriding procedure Finalize (Control : in out Reference_Control_Type);
pragma Inline (Finalize);
diff --git a/gcc/ada/libgnat/a-ciorse.adb b/gcc/ada/libgnat/a-ciorse.adb
index d90fb88..fe91345 100644
--- a/gcc/ada/libgnat/a-ciorse.adb
+++ b/gcc/ada/libgnat/a-ciorse.adb
@@ -807,6 +807,18 @@ is
Is_Less_Key_Node => Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
+ ------------
+ -- Adjust --
+ ------------
+
+ procedure Adjust (Control : in out Reference_Control_Type) is
+ begin
+ Impl.Reference_Control_Type (Control).Adjust;
+ if Control.Old_Key /= null then
+ Control.Old_Key := new Key_Type'(Control.Old_Key.all);
+ end if;
+ end Adjust;
+
-------------
-- Ceiling --
-------------
@@ -906,6 +918,8 @@ is
--------------
procedure Finalize (Control : in out Reference_Control_Type) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation (Key_Type, Key_Access);
begin
if Control.Container /= null then
Impl.Reference_Control_Type (Control).Finalize;
@@ -917,7 +931,7 @@ is
end if;
Control.Container := null;
- Control.Old_Key := null;
+ Deallocate (Control.Old_Key);
end if;
end Finalize;
diff --git a/gcc/ada/libgnat/a-ciorse.ads b/gcc/ada/libgnat/a-ciorse.ads
index a8a87cd..5bc9800 100644
--- a/gcc/ada/libgnat/a-ciorse.ads
+++ b/gcc/ada/libgnat/a-ciorse.ads
@@ -338,6 +338,9 @@ is
Old_Key : Key_Access;
end record;
+ overriding procedure Adjust (Control : in out Reference_Control_Type);
+ pragma Inline (Adjust);
+
overriding procedure Finalize (Control : in out Reference_Control_Type);
pragma Inline (Finalize);
diff --git a/gcc/ada/libgnat/a-coorse.adb b/gcc/ada/libgnat/a-coorse.adb
index ca97fa4..a324b54 100644
--- a/gcc/ada/libgnat/a-coorse.adb
+++ b/gcc/ada/libgnat/a-coorse.adb
@@ -729,6 +729,18 @@ is
Is_Less_Key_Node => Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
+ ------------
+ -- Adjust --
+ ------------
+
+ procedure Adjust (Control : in out Reference_Control_Type) is
+ begin
+ Impl.Reference_Control_Type (Control).Adjust;
+ if Control.Old_Key /= null then
+ Control.Old_Key := new Key_Type'(Control.Old_Key.all);
+ end if;
+ end Adjust;
+
-------------
-- Ceiling --
-------------
@@ -825,6 +837,8 @@ is
--------------
procedure Finalize (Control : in out Reference_Control_Type) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation (Key_Type, Key_Access);
begin
if Control.Container /= null then
Impl.Reference_Control_Type (Control).Finalize;
@@ -836,7 +850,7 @@ is
end if;
Control.Container := null;
- Control.Old_Key := null;
+ Deallocate (Control.Old_Key);
end if;
end Finalize;
diff --git a/gcc/ada/libgnat/a-coorse.ads b/gcc/ada/libgnat/a-coorse.ads
index 1470875..ab83e1a 100644
--- a/gcc/ada/libgnat/a-coorse.ads
+++ b/gcc/ada/libgnat/a-coorse.ads
@@ -323,6 +323,9 @@ is
Old_Key : Key_Access;
end record;
+ overriding procedure Adjust (Control : in out Reference_Control_Type);
+ pragma Inline (Adjust);
+
overriding procedure Finalize (Control : in out Reference_Control_Type);
pragma Inline (Finalize);
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 01fed40..dd9f868 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -22220,7 +22220,11 @@ package body Sem_Util is
elsif Is_Record_Type (Input_Typ) then
Comp := First_Component (Input_Typ);
while Present (Comp) loop
- if Needs_Finalization (Etype (Comp)) then
+ -- Skip _Parent component like Expand_Freeze_Record_Type
+
+ if Chars (Comp) /= Name_uParent
+ and then Needs_Finalization (Etype (Comp))
+ then
return True;
end if;