-- non-static subtypes, even though such references are not static
-- expressions.
+ -- For VAX float, the root type is an IEEE type. So make sure to use the
+ -- base type instead of the root-type for floating point attributes.
+
case Id is
-- Attributes related to Ada 2012 iterators (placeholder ???)
when Attribute_Adjacent =>
Fold_Ureal (N,
Eval_Fat.Adjacent
- (P_Root_Type, Expr_Value_R (E1), Expr_Value_R (E2)), Static);
+ (P_Base_Type, Expr_Value_R (E1), Expr_Value_R (E2)), Static);
---------
-- Aft --
when Attribute_Ceiling =>
Fold_Ureal (N,
- Eval_Fat.Ceiling (P_Root_Type, Expr_Value_R (E1)), Static);
+ Eval_Fat.Ceiling (P_Base_Type, Expr_Value_R (E1)), Static);
--------------------
-- Component_Size --
when Attribute_Compose =>
Fold_Ureal (N,
Eval_Fat.Compose
- (P_Root_Type, Expr_Value_R (E1), Expr_Value (E2)),
+ (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)),
Static);
-----------------
when Attribute_Copy_Sign =>
Fold_Ureal (N,
Eval_Fat.Copy_Sign
- (P_Root_Type, Expr_Value_R (E1), Expr_Value_R (E2)), Static);
+ (P_Base_Type, Expr_Value_R (E1), Expr_Value_R (E2)), Static);
--------------
-- Definite --
when Attribute_Exponent =>
Fold_Uint (N,
- Eval_Fat.Exponent (P_Root_Type, Expr_Value_R (E1)), Static);
+ Eval_Fat.Exponent (P_Base_Type, Expr_Value_R (E1)), Static);
-----------
-- First --
when Attribute_Floor =>
Fold_Ureal (N,
- Eval_Fat.Floor (P_Root_Type, Expr_Value_R (E1)), Static);
+ Eval_Fat.Floor (P_Base_Type, Expr_Value_R (E1)), Static);
----------
-- Fore --
when Attribute_Fraction =>
Fold_Ureal (N,
- Eval_Fat.Fraction (P_Root_Type, Expr_Value_R (E1)), Static);
+ Eval_Fat.Fraction (P_Base_Type, Expr_Value_R (E1)), Static);
-----------------------
-- Has_Access_Values --
when Attribute_Leading_Part =>
Fold_Ureal (N,
Eval_Fat.Leading_Part
- (P_Root_Type, Expr_Value_R (E1), Expr_Value (E2)), Static);
+ (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)), Static);
------------
-- Length --
when Attribute_Machine =>
Fold_Ureal (N,
Eval_Fat.Machine
- (P_Root_Type, Expr_Value_R (E1), Eval_Fat.Round, N),
+ (P_Base_Type, Expr_Value_R (E1), Eval_Fat.Round, N),
Static);
------------------
when Attribute_Machine_Rounding =>
Fold_Ureal (N,
- Eval_Fat.Rounding (P_Root_Type, Expr_Value_R (E1)), Static);
+ Eval_Fat.Rounding (P_Base_Type, Expr_Value_R (E1)), Static);
--------------------
-- Machine_Rounds --
when Attribute_Model =>
Fold_Ureal (N,
- Eval_Fat.Model (P_Root_Type, Expr_Value_R (E1)), Static);
+ Eval_Fat.Model (P_Base_Type, Expr_Value_R (E1)), Static);
----------------
-- Model_Emin --
if Is_Floating_Point_Type (P_Type) then
Fold_Ureal (N,
- Eval_Fat.Pred (P_Root_Type, Expr_Value_R (E1)), Static);
+ Eval_Fat.Pred (P_Base_Type, Expr_Value_R (E1)), Static);
-- Fixed-point case
return;
end if;
- Fold_Ureal (N, Eval_Fat.Remainder (P_Root_Type, X, Y), Static);
+ Fold_Ureal (N, Eval_Fat.Remainder (P_Base_Type, X, Y), Static);
end Remainder;
-----------
when Attribute_Rounding =>
Fold_Ureal (N,
- Eval_Fat.Rounding (P_Root_Type, Expr_Value_R (E1)), Static);
+ Eval_Fat.Rounding (P_Base_Type, Expr_Value_R (E1)), Static);
---------------
-- Safe_Emax --
when Attribute_Scaling =>
Fold_Ureal (N,
Eval_Fat.Scaling
- (P_Root_Type, Expr_Value_R (E1), Expr_Value (E2)), Static);
+ (P_Base_Type, Expr_Value_R (E1), Expr_Value (E2)), Static);
------------------
-- Signed_Zeros --
if Is_Floating_Point_Type (P_Type) then
Fold_Ureal (N,
- Eval_Fat.Succ (P_Root_Type, Expr_Value_R (E1)), Static);
+ Eval_Fat.Succ (P_Base_Type, Expr_Value_R (E1)), Static);
-- Fixed-point case
when Attribute_Truncation =>
Fold_Ureal (N,
- Eval_Fat.Truncation (P_Root_Type, Expr_Value_R (E1)), Static);
+ Eval_Fat.Truncation (P_Base_Type, Expr_Value_R (E1)), Static);
----------------
-- Type_Class --
when Attribute_Unbiased_Rounding =>
Fold_Ureal (N,
- Eval_Fat.Unbiased_Rounding (P_Root_Type, Expr_Value_R (E1)),
+ Eval_Fat.Unbiased_Rounding (P_Base_Type, Expr_Value_R (E1)),
Static);
-------------------------
if Is_Scalar_Type (Ent) then
Set_Default_Aspect_Value (Ent, Expr);
+
+ -- Place default value of base type as well, because that is
+ -- the semantics of the aspect. It is convenient to link the
+ -- aspect to both the (possibly anonymous) base type and to
+ -- the given first subtype.
+
+ Set_Default_Aspect_Value (Base_Type (Ent), Expr);
+
else
Set_Default_Aspect_Component_Value (Ent, Expr);
end if;
end if;
Set_Is_Delayed_Aspect (Aspect);
+
+ -- In the case of Default_Value, link aspect to base type
+ -- as well, even though it appears on a first subtype. This
+ -- is mandated by the semantics of the aspect. Verify that
+ -- this a scalar type, to prevent cascaded errors.
+
+ if A_Id = Aspect_Default_Value
+ and then Is_Scalar_Type (E)
+ then
+ Set_Has_Delayed_Aspects (Base_Type (E));
+ Record_Rep_Item (Base_Type (E), Aspect);
+ end if;
+
Set_Has_Delayed_Aspects (E);
Record_Rep_Item (E, Aspect);