Unsigned_Base_Range is erroneously enabled when set to False.
gcc/ada/ChangeLog:
* sem_ch13.adb (Analyze_One_Aspect): For Unsigned_Base_Range aspect,
skip generating its corresponding pragma when the aspect is set
to False.
* sem_ch3.adb (Analyze_Full_Type_Declaration): Fix initialization
of local variable Is_Unsigned_Base_Range_Type_Decl to handle
Unsigned_Base_Range aspect set to False.
then
Delay_Required := False;
- -- For Unsigned_Base_Range aspect, do not delay becase we
+ -- For Unsigned_Base_Range aspect, do not delay because we
-- need to process it before any type or subtype derivation
-- is analyzed.
goto Continue;
-- GNAT Core Extension: Checks for this aspect are performed
- -- when the corresponding pragma is analyzed.
+ -- when the corresponding pragma is analyzed; if aspect has
+ -- no effect, pragma generation is skipped.
elsif A_Id = Aspect_Unsigned_Base_Range then
- null;
+ if Present (Expr) then
+ Analyze_And_Resolve (Expr, Standard_Boolean);
+
+ if Is_False (Static_Boolean (Expr)) then
+ goto Continue;
+ end if;
+ end if;
-- Ada 2022 (AI12-0279)
begin
if Present (Aspect_Specifications (Parent (Def))) then
declare
- Asp : Node_Id;
+ Asp : Node_Id;
+ Expr : Node_Id;
+
begin
Asp := First (Aspect_Specifications (Parent (Def)));
while Present (Asp) loop
if Chars (Identifier (Asp)) = Name_Unsigned_Base_Range then
- Is_Unsigned_Base_Range_Type_Decl := True;
+ Expr := Expression (Asp);
+
+ if Present (Expr) then
+ Analyze_And_Resolve (Expr, Standard_Boolean);
+ end if;
+
+ Is_Unsigned_Base_Range_Type_Decl :=
+ No (Expression (Asp))
+ or else Is_True (Static_Boolean (Expr));
exit;
end if;