===================================================================
@@ -203,6 +203,15 @@
-- renaming_as_body. For tagged types, the specification is one of the
-- primitive specs.
+ procedure Register_Address_Clause_Check
+ (N : Node_Id;
+ X : Entity_Id;
+ A : Uint;
+ Y : Entity_Id;
+ Off : Boolean);
+ -- Register a check for the address clause N. The rest of the parameters
+ -- are in keeping with the components of Address_Clause_Check_Record below.
+
procedure Resolve_Iterable_Operation
(N : Node_Id;
Cursor : Entity_Id;
@@ -318,6 +327,11 @@
Off : Boolean;
-- Whether the address is offset within Y in the second case
+
+ Alignment_Checks_Suppressed : Boolean;
+ -- Whether alignment checks are suppressed by an active scope suppress
+ -- setting. We need to save the value in order to be able to reuse it
+ -- after the back end has been run.
end record;
package Address_Clause_Checks is new Table.Table (
@@ -328,6 +342,26 @@
Table_Increment => 200,
Table_Name => "Address_Clause_Checks");
+ function Alignment_Checks_Suppressed
+ (ACCR : Address_Clause_Check_Record) return Boolean;
+ -- Return whether the alignment check generated for the address clause
+ -- is suppressed.
+
+ ---------------------------------
+ -- Alignment_Checks_Suppressed --
+ ---------------------------------
+
+ function Alignment_Checks_Suppressed
+ (ACCR : Address_Clause_Check_Record) return Boolean
+ is
+ begin
+ if Checks_May_Be_Suppressed (ACCR.X) then
+ return Is_Check_Suppressed (ACCR.X, Alignment_Check);
+ else
+ return ACCR.Alignment_Checks_Suppressed;
+ end if;
+ end Alignment_Checks_Suppressed;
+
-----------------------------------------
-- Adjust_Record_For_Reverse_Bit_Order --
-----------------------------------------
@@ -5047,8 +5081,8 @@
and then not Is_Generic_Type (Etype (U_Ent))
and then Address_Clause_Overlay_Warnings
then
- Address_Clause_Checks.Append
- ((N, U_Ent, No_Uint, O_Ent, Off));
+ Register_Address_Clause_Check
+ (N, U_Ent, No_Uint, O_Ent, Off);
end if;
else
-- If this is not an overlay, mark a variable as being
@@ -5073,8 +5107,8 @@
if Compile_Time_Known_Value (Addr)
and then Address_Clause_Overlay_Warnings
then
- Address_Clause_Checks.Append
- ((N, U_Ent, Expr_Value (Addr), Empty, False));
+ Register_Address_Clause_Check
+ (N, U_Ent, Expr_Value (Addr), Empty, False);
end if;
end;
end if;
@@ -12254,6 +12288,22 @@
end if;
end Push_Scope_And_Install_Discriminants;
+ -----------------------------------
+ -- Register_Address_Clause_Check --
+ -----------------------------------
+
+ procedure Register_Address_Clause_Check
+ (N : Node_Id;
+ X : Entity_Id;
+ A : Uint;
+ Y : Entity_Id;
+ Off : Boolean)
+ is
+ ACS : constant Boolean := Scope_Suppress.Suppress (Alignment_Check);
+ begin
+ Address_Clause_Checks.Append ((N, X, A, Y, Off, ACS));
+ end Register_Address_Clause_Check;
+
------------------------
-- Rep_Item_Too_Early --
------------------------
@@ -13465,7 +13515,7 @@
-- Check for known value not multiple of alignment
if No (ACCR.Y) then
- if not Alignment_Checks_Suppressed (ACCR.X)
+ if not Alignment_Checks_Suppressed (ACCR)
and then X_Alignment /= 0
and then ACCR.A mod X_Alignment /= 0
then
@@ -13510,7 +13560,7 @@
-- Note: we do not check the alignment if we gave a size
-- warning, since it would likely be redundant.
- elsif not Alignment_Checks_Suppressed (ACCR.X)
+ elsif not Alignment_Checks_Suppressed (ACCR)
and then Y_Alignment /= Uint_0
and then
(Y_Alignment < X_Alignment