===================================================================
@@ -1828,11 +1828,29 @@
Object_Definition => New_Reference_To (Typ, Loc),
Expression => Relocate_Node (Prefix (LE))));
+ -- Perform minor decoration as this information will be needed for
+ -- the creation of index checks (if applicable).
+
+ Set_Ekind (Temp, E_Constant);
+ Set_Etype (Temp, Typ);
+
-- Replace the original attribute with a reference to the constant
Rewrite (LE, New_Reference_To (Temp, Loc));
Set_Etype (LE, Typ);
+ -- Analysis converts attribute references of the following form
+
+ -- Prefix'Loop_Entry (Expr)
+ -- Prefix'Loop_Entry (Expr1, Expr2, ... ExprN)
+
+ -- into indexed components for error detection purposes. Generate
+ -- index checks now that 'Loop_Entry has been properly expanded.
+
+ if Nkind (Parent (LE)) = N_Indexed_Component then
+ Generate_Index_Checks (Parent (LE));
+ end if;
+
Next_Elmt (LE_Elmt);
end loop;
===================================================================
@@ -5522,6 +5522,23 @@
or else Index_Checks_Suppressed (Etype (A))
then
return;
+
+ -- The indexed component we are dealing with contains 'Loop_Entry in its
+ -- prefix. This case arises when analysis has determined that constructs
+ -- such as
+
+ -- Prefix'Loop_Entry (Expr)
+ -- Prefix'Loop_Entry (Expr1, Expr2, ... ExprN)
+
+ -- require rewriting for error detection purposes. A side effect of this
+ -- action is the generation of index checks that mention 'Loop_Entry.
+ -- Delay the generation of the check until 'Loop_Entry has been properly
+ -- expanded. This is done in Expand_Loop_Entry_Attributes.
+
+ elsif Nkind (Prefix (N)) = N_Attribute_Reference
+ and then Attribute_Name (Prefix (N)) = Name_Loop_Entry
+ then
+ return;
end if;
-- Generate a raise of constraint error with the appropriate reason and