-- current declarative part to look for an address clause for the object
-- being declared, and returns the clause if one is found, returns
-- Empty otherwise.
- --
- -- Note: this function can be costly and must be invoked with special care.
- -- Possibly we could introduce a flag at parse time indicating the presence
- -- of an address clause to speed this up???
- --
- -- Note: currently this function does not scan the private part, that seems
- -- like a potential bug ???
type Force_Evaluation_Mode is (Relaxed, Strict);
elsif No (E) and then Is_Null_Record_Type (T) then
null;
+ -- If there is an address clause for this object, do not generate a
+ -- predicate check here. It will be generated later, at the freezng
+ -- point. It would be wrong to generate references to the object
+ -- here, before the address has been determined.
+
+ elsif Has_Aspect (Id, Aspect_Address)
+ or else Present (Following_Address_Clause (N))
+ then
+ null;
+
-- Do not generate a predicate check if the initialization expression
-- is a type conversion whose target subtype statically matches the
-- object's subtype because the conversion has been subjected to the
declare
Check : constant Node_Id :=
Make_Predicate_Check (T, New_Occurrence_Of (Id, Loc));
-
begin
if No (Next_Decl) then
Append_To (List_Containing (N), Check);