aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch6.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2023-01-08 18:22:17 -0500
committerMarc Poulhiès <poulhies@adacore.com>2023-05-15 11:36:42 +0200
commitd2a1dcf72f793d671512bd5638d5b66eb19e8ca6 (patch)
tree5ab875c75a755fefd8cc712048ccb8f91d2ba549 /gcc/ada/sem_ch6.adb
parent0ca7fcf5635bdd363a5a18e7cf5828d87b5aac55 (diff)
downloadgcc-d2a1dcf72f793d671512bd5638d5b66eb19e8ca6.zip
gcc-d2a1dcf72f793d671512bd5638d5b66eb19e8ca6.tar.gz
gcc-d2a1dcf72f793d671512bd5638d5b66eb19e8ca6.tar.bz2
ada: Clean up vanishing entity fields
Fix all the failures caused by enabling Check_Vanishing_Fields on entities in all cases except the case of converting to or from E_Void. But leave Check_Vanishing_Fields disabled by default (controlled by -gnatd_v flag), because it might be too slow even for assertions-on mode, and we should deal with the E_Void cases eventually. The failures are fixed either by adding calls to Reinit_Field_To_Zero, or by changing which entities have which fields. Note that in a series of Reinit_Field_To_Zero calls, the optional Old_Ekind parameter is only useful on the first such call. gcc/ada/ * atree.adb (Check_Vanishing_Fields): Disable the check for "root/base type only" fields. This is a bug fix -- if we're checking some subtype S, we don't want to reach over to the root or base type and Reinit_Field_To_Zero of that, thus modifying the field for lots of subtypes other than S. Disable in the to/from E_Void cases. Misc cleanup. * gen_il-gen-gen_entities.adb: Define First_Entity, Last_Entity, and Stored_Constraint for all type entities, because there are too many cases where Reinit_Field_To_Zero would otherwise be needed. In any case, it seems cleaner to have First_Entity and Last_Entity defined in the same entity kinds. * einfo.ads: (First_Entity, Last_Entity, Stored_Constraint): Update comments to reflect gen_il-gen-gen_entities.adb changes. (Lit_Hash): Add missing "[root type only]" comment. * exp_ch5.adb: Add Reinit_Field_To_Zero calls for vanishing fields. * sem_ch10.adb: Likewise. * sem_ch6.adb: Likewise. * sem_ch7.adb: Likewise. * sem_ch8.adb: Likewise. * sem_ch3.adb: Likewise. Also remove now-unnecessary Reinit_Field_To_Zero calls.
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r--gcc/ada/sem_ch6.adb20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index d4701ae..8c1fb8c 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -1225,6 +1225,10 @@ package body Sem_Ch6 is
(E_Function | E_Procedure |
E_Generic_Function | E_Generic_Procedure => True,
others => False));
+ Reinit_Field_To_Zero (Body_Id, F_Needs_No_Actuals);
+ if Ekind (Body_Id) in E_Function | E_Procedure then
+ Reinit_Field_To_Zero (Body_Id, F_Is_Inlined_Always);
+ end if;
Mutate_Ekind (Body_Id, E_Subprogram_Body);
Set_Convention (Body_Id, Convention (Gen_Id));
Set_Is_Obsolescent (Body_Id, Is_Obsolescent (Gen_Id));
@@ -4002,13 +4006,17 @@ package body Sem_Ch6 is
Reference_Body_Formals (Spec_Id, Body_Id);
end if;
- Reinit_Field_To_Zero (Body_Id, F_Has_Out_Or_In_Out_Parameter);
- Reinit_Field_To_Zero (Body_Id, F_Needs_No_Actuals,
- Old_Ekind => (E_Function | E_Procedure => True, others => False));
- Reinit_Field_To_Zero (Body_Id, F_Is_Predicate_Function,
- Old_Ekind => (E_Function | E_Procedure => True, others => False));
- Reinit_Field_To_Zero (Body_Id, F_Protected_Subprogram,
+ Reinit_Field_To_Zero (Body_Id, F_Has_Out_Or_In_Out_Parameter,
Old_Ekind => (E_Function | E_Procedure => True, others => False));
+ Reinit_Field_To_Zero (Body_Id, F_Needs_No_Actuals);
+ Reinit_Field_To_Zero (Body_Id, F_Is_Predicate_Function);
+ Reinit_Field_To_Zero (Body_Id, F_Protected_Subprogram);
+ Reinit_Field_To_Zero (Body_Id, F_Is_Inlined_Always);
+ Reinit_Field_To_Zero (Body_Id, F_Is_Generic_Actual_Subprogram);
+ Reinit_Field_To_Zero (Body_Id, F_Is_Primitive_Wrapper);
+ Reinit_Field_To_Zero (Body_Id, F_Is_Private_Primitive);
+ Reinit_Field_To_Zero (Body_Id, F_Original_Protected_Subprogram);
+ Reinit_Field_To_Zero (Body_Id, F_Wrapped_Entity);
if Ekind (Body_Id) = E_Procedure then
Reinit_Field_To_Zero (Body_Id, F_Receiving_Entry);