aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/einfo.ads
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-01-16 09:18:15 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-07 09:55:56 +0200
commit5c8f6ee3663fc77834d1eb5f2d16e7d3ceb5d8cd (patch)
treed9f649fd2e0b710845cd4f1e77066fb13ab4c7dc /gcc/ada/einfo.ads
parent6e0494ecf00540b996014e3bc6db6a2d6529c6d7 (diff)
downloadgcc-5c8f6ee3663fc77834d1eb5f2d16e7d3ceb5d8cd.zip
gcc-5c8f6ee3663fc77834d1eb5f2d16e7d3ceb5d8cd.tar.gz
gcc-5c8f6ee3663fc77834d1eb5f2d16e7d3ceb5d8cd.tar.bz2
ada: Fix bad interaction between homogeneous finalization master and BIP protocol
Dynamically-allocated objects that require finalization are attached to a finalization master, which is of a (limited) controlled type declared in the System.Finalization_Masters unit. Now there are two kinds of them: homogeneous and heterogeneous; for the former, all the objects attached to the master share the same Finalize_Address primitive whereas, for the latter, they may have different Finalize_Address primitives. There is a problem in this scheme with the BIP protocol, because this protocol forwards the finalization master from callers to callees and it does so even if the result types are distinct, so it is possible for a homogeneous finalization master to end up containing objects with different Finalize_Address primitives; in that case, the object attached last wins and sets the common Finalize_Address, which is then used to finalize other objects with unpredictable outcome (and very loud valgrind report). Therefore, this change gets rid of homogeneous finalization masters and also streamlines the implementation of heterogeneous ones by storing the Finalize_Address primitive on a per object basis in the FM_Node record. gcc/ada/ * einfo.ads (Pending_Access_Types): Delete. * exp_ch3.adb (Freeze_Type.Process_Pending_Access_Types): Likewise. (Freeze_Type): Do not call Process_Pending_Access_Types. * exp_ch7.ads (Make_Set_Finalize_Address_Call): Delete. * exp_ch7.adb (Build_Finalization_Master.Add_Pending_Access_Type): Delete. (Build_Finalization_Master): Do not set Finalize_Address on the master or call Add_Pending_Access_Type. (Make_Set_Finalize_Address_Call): Delete. * gen_il-fields.ads (Opt_Field_Enum): Remove Pending_Access_Types. * gen_il-gen-gen_entities.adb (Type_Kind): Likewise. * rtsfind.ads (RE_Id): Remove RE_Set_Finalize_Address. (RE_Unit_Table): Likewise. * sem_ch3.adb (Analyze_Full_Type_Declaration): Do not deal with pending access types. * libgnat/s-finmas.ads (Attach_Unprotected): Add Finalize_Address second parameter. (Delete_Finalize_Address_Unprotected): Delete. (Finalize_Address): Likewise. (Finalize_Address_Unprotected): Likewise. (Is_Homogeneous): Likewise. (Set_Finalize_Address): Likewise. (Set_Finalize_Address_Unprotected): Likewise. (Set_Heterogeneous_Finalize_Address_Unprotected): Likewise. (Set_Is_Heterogeneous): Likewise. (FM_Node): Add Finalize_Address component. (Finalization_Master): Remove Is_Homogeneous and Finalize_Address components. * libgnat/s-finmas.adb: Remove with & use clauses for System.HTable. (Finalize_Address_Table): Delete. (Attach_Unprotected): Add Finalize_Address second parameter and save its value in the Finalize_Address field of the node. (Delete_Finalize_Address_Unprotected): Delete. (Finalize): Call Finalize_Address saved in the nodes. (Finalize_Address): Delete. (Finalize_Address_Unprotected): Likewise. (Hash): Likewise. (Is_Homogeneous): Likewise. (Print_Master): Adjust. (Set_Finalize_Address): Delete. (Set_Finalize_Address_Unprotected): Likewise. (Set_Heterogeneous_Finalize_Address_Unprotected): Likewise. (Set_Is_Heterogeneous): Likewise. * libgnat/s-stposu.adb (Finalize_Address_Table_In_Use): Likewise. (Allocate_Any_Controlled): Pass Fin_Address to Attach_Unprotected and remove obsolete processing. (Deallocate_Any_Controlled): Remove obsolete processing. (Set_Pool_Of_Subpool): Do not call Set_Is_Heterogeneous.
Diffstat (limited to 'gcc/ada/einfo.ads')
-rw-r--r--gcc/ada/einfo.ads9
1 files changed, 0 insertions, 9 deletions
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 3c290ef..c45c124 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -4008,14 +4008,6 @@ package Einfo is
-- has unknown discriminants. A default initialization of an object of
-- the type does not require an invariant check (AI12-0133).
--- Pending_Access_Types
--- Defined in all types. Set for incomplete, private, Taft-amendment
--- types, and their corresponding full views. This list contains all
--- access types, both named and anonymous, declared between the partial
--- and the full view. The list is used by the finalization machinery to
--- ensure that the finalization masters of all pending access types are
--- fully initialized when the full view is frozen.
-
-- Predicate_Function (synthesized)
-- Defined in all types. Set for types for which (Has_Predicates is True)
-- and for which a predicate procedure has been built that tests that the
@@ -4995,7 +4987,6 @@ package Einfo is
-- Esize
-- RM_Size
-- Alignment
- -- Pending_Access_Types
-- Related_Expression
-- Current_Use_Clause
-- Subprograms_For_Type