2018-05-23 Bob Duff <duff@adacore.com>
+ * freeze.adb: (Check_Address_Clause): Deal with build-in-place
+ aggregates in addition to build-in-place calls.
+
+2018-05-23 Bob Duff <duff@adacore.com>
+
* einfo.ads: Minor reformatting.
* sem_ch3.adb: Likewise.
* sinfo.ads: Likewise.
end;
end if;
- -- Remove side effects from initial expression, except in the case
- -- of a build-in-place call, which has its own later expansion.
+ -- Remove side effects from initial expression, except in the case of
+ -- limited build-in-place calls and aggregates, which have their own
+ -- expansion elsewhere. This exception is necessary to avoid copying
+ -- limited objects.
- if Present (Init)
- and then (Nkind (Init) /= N_Function_Call
- or else not Is_Expanded_Build_In_Place_Call (Init))
- then
+ if Present (Init) and then not Is_Limited_View (Typ) then
-- Capture initialization value at point of declaration, and make
-- explicit assignment legal, because object may be a constant.
Set_No_Initialization (Decl);
- -- If the objet is tagged, check whether the tag must be
+ -- If the object is tagged, check whether the tag must be
-- reassigned explicitly.
Tag_Assign := Make_Tag_Assignment (Decl);
--- /dev/null
+-- { dg-do compile }
+
+with System;
+
+procedure Addr10 is
+ type Limited_Type is limited record
+ Element : Integer;
+ end record;
+
+ function Initial_State return Limited_Type is ((Element => 0));
+
+ type Double_Limited_Type is
+ record
+ A : Limited_Type;
+ end record;
+
+ Double_Limited : Double_Limited_Type :=
+ (A => Initial_State)
+ with
+ Volatile,
+ Address => System'To_Address (16#1234_5678#);
+begin
+ null;
+end Addr10;