aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/aspects.ads
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-07-17 12:38:15 +0200
committerMarc Poulhiès <poulhies@adacore.com>2022-09-05 09:21:01 +0200
commitae035e3437c1ec7d96773b31e631ec121bb4153f (patch)
treeffa89f6d57401aa54b31a9b09c23e9ec8a343305 /gcc/ada/aspects.ads
parent88fbab0d71bc161aae1353a817594d14d977b0ea (diff)
downloadgcc-ae035e3437c1ec7d96773b31e631ec121bb4153f.zip
gcc-ae035e3437c1ec7d96773b31e631ec121bb4153f.tar.gz
gcc-ae035e3437c1ec7d96773b31e631ec121bb4153f.tar.bz2
[Ada] Fix crash for Default_Initial_Condition on derived enumeration type
This fixes a crash on the declaration of a private derived enumeration type with the Default_Initial_Condition aspect and in the process makes a couple of related adjustments: 1) removes the early freezing of implicit character and numeric base types and 2) fixes an oversight in the implementation of delayed representation aspects. gcc/ada/ * aspects.ads (Delaying Evaluation of Aspect): Fix typos. * exp_ch3.adb (Freeze_Type): Do not generate Invariant and DIC procedures for internal types. * exp_util.adb (Build_DIC_Procedure_Body): Adjust comment. * freeze.adb (Freeze_Entity): Call Inherit_Delayed_Rep_Aspects for subtypes and derived types only after the base or parent type has been frozen. Remove useless freezing for first subtype. (Freeze_Fixed_Point_Type): Call Inherit_Delayed_Rep_Aspects too. * layout.adb (Set_Elem_Alignment): Deal with private types. * sem_ch3.adb (Build_Derived_Enumeration_Type): Build the implicit base as an itype and do not insert its declaration in the tree. (Build_Derived_Numeric_Type): Do not freeze the implicit base. (Derived_Standard_Character): Likewise. (Constrain_Enumeration): Inherit the chain of representation items instead of replacing it. * sem_ch13.ads (Inherit_Aspects_At_Freeze_Point): Add ??? comment. (Inherit_Delayed_Rep_Aspects): Declare. * sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Do not invoke Inherit_Delayed_Rep_Aspects. (Inherit_Aspects_At_Freeze_Point): Deal with private types. (Inherit_Delayed_Rep_Aspects): Move to library level.
Diffstat (limited to 'gcc/ada/aspects.ads')
-rw-r--r--gcc/ada/aspects.ads6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads
index 6559cda..2edb608 100644
--- a/gcc/ada/aspects.ads
+++ b/gcc/ada/aspects.ads
@@ -822,11 +822,11 @@ package Aspects is
-- set on the parent type if it has delayed representation aspects. This
-- flag Has_Delayed_Rep_Aspects indicates that if we derive from this type
-- we have to worry about making sure we inherit any delayed aspects. The
- -- second flag is set on a derived type: May_Have_Inherited_Rep_Aspects
+ -- second flag is set on a derived type: May_Inherit_Delayed_Rep_Aspects
-- is set if the parent type has Has_Delayed_Rep_Aspects set.
- -- When we freeze a derived type, if the May_Have_Inherited_Rep_Aspects
- -- flag is set, then we call Freeze.Inherit_Delayed_Rep_Aspects when
+ -- When we freeze a derived type, if the May_Inherit_Delayed_Rep_Aspects
+ -- flag is set, then we call Sem_Ch13.Inherit_Delayed_Rep_Aspects when
-- the derived type is frozen, which deals with the necessary copying of
-- information from the parent type, which must be frozen at that point
-- (since freezing the derived type first freezes the parent type).