-- 1) Get access to the allocated object
Rewrite (N,
- Make_Explicit_Dereference (Loc,
- Relocate_Node (N)));
+ Make_Explicit_Dereference (Loc, Relocate_Node (N)));
Set_Etype (N, Etyp);
Set_Analyzed (N);
-- Insert explicit dereference call for the checked storage pool case
Insert_Dereference_Action (Prefix (N));
+
+ -- If the type is an Atomic type for which Atomic_Sync is enabled, then
+ -- we set the atomic sync flag.
+
+ if Is_Atomic (Etype (N))
+ and then not Atomic_Synchronization_Disabled (Etype (N))
+ then
+ Set_Atomic_Sync_Required (N);
+
+ -- Generate info message if requested
+
+ if Warn_On_Atomic_Synchronization then
+ Error_Msg_N ("?info: atomic synchronization set", N);
+ end if;
+ end if;
end Expand_N_Explicit_Dereference;
--------------------------------------
Typ : constant Entity_Id := Etype (N);
P : constant Node_Id := Prefix (N);
T : constant Entity_Id := Etype (P);
+ Atp : Entity_Id;
begin
-- A special optimization, if we have an indexed component that is
if Is_Access_Type (T) then
Insert_Explicit_Dereference (P);
Analyze_And_Resolve (P, Designated_Type (T));
+ Atp := Designated_Type (T);
+ else
+ Atp := T;
end if;
-- Generate index and validity checks
Apply_Subscript_Validity_Checks (N);
end if;
+ -- If selecting from an array with atomic components, and atomic sync
+ -- is not suppressed for this array type, set atomic sync flag.
+
+ if (Has_Atomic_Components (Atp)
+ and then not Atomic_Synchronization_Disabled (Atp))
+ or else (Is_Atomic (Typ)
+ and then not Atomic_Synchronization_Disabled (Typ))
+ then
+ Set_Atomic_Sync_Required (N);
+
+ -- Generate info message if requested
+
+ if Warn_On_Atomic_Synchronization then
+ Error_Msg_N ("?info: atomic synchronization set", N);
+ end if;
+ end if;
+
-- All done for the non-packed case
if not Is_Packed (Etype (Prefix (N))) then
-- Expand_N_Selected_Component --
---------------------------------
- -- If the selector is a discriminant of a concurrent object, rewrite the
- -- prefix to denote the corresponding record type.
-
procedure Expand_N_Selected_Component (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Par : constant Node_Id := Parent (N);
Rewrite (N, New_N);
Analyze (N);
end if;
+
+ -- If we still have a selected component, and the type is an Atomic
+ -- type for which Atomic_Sync is enabled, then we set the atomic sync
+ -- flag on the selector.
+
+ if Nkind (N) = N_Selected_Component
+ and then Is_Atomic (Etype (N))
+ and then not Atomic_Synchronization_Disabled (Etype (N))
+ then
+ Set_Atomic_Sync_Required (Selector_Name (N));
+
+ -- Generate info message if requested
+
+ if Warn_On_Atomic_Synchronization then
+ Error_Msg_N
+ ("?info: atomic synchronization set for &", Selector_Name (N));
+ end if;
+ end if;
end Expand_N_Selected_Component;
--------------------