+2019-07-04 Justin Squirek <squirek@adacore.com>
+
+ * exp_ch3.adb (Build_Initialization_Call): Fixup
+ *_skip_null_excluding_check argument to handle new default.
+ (Init_Formals): Make *_skip_null_excluding_check formal default
+ to False
+ * exp_ch4.adb (Expand_N_Allocator): Add comment to note heavy
+ code duplication
+
2019-07-04 Bob Duff <duff@adacore.com>
* sem_ch3.adb (Access_Definition): Do not create a master unless
-- Handle the optionally generated formal *_skip_null_excluding_checks
- if Needs_Conditional_Null_Excluding_Check (Full_Init_Type) then
-
- -- Look at the associated node for the object we are referencing
- -- and verify that we are expanding a call to an Init_Proc for an
- -- internally generated object declaration before passing True and
- -- skipping the relevant checks.
-
- if Nkind (Id_Ref) in N_Has_Entity
- and then Comes_From_Source (Associated_Node (Id_Ref))
- then
- Append_To (Args, New_Occurrence_Of (Standard_True, Loc));
-
- -- Otherwise, we pass False to perform null-excluding checks
-
- else
- Append_To (Args, New_Occurrence_Of (Standard_False, Loc));
- end if;
+ -- Look at the associated node for the object we are referencing and
+ -- verify that we are expanding a call to an Init_Proc for an internally
+ -- generated object declaration before passing True and skipping the
+ -- relevant checks.
+
+ if Needs_Conditional_Null_Excluding_Check (Full_Init_Type)
+ and then Nkind (Id_Ref) in N_Has_Entity
+ and then (Comes_From_Source (Id_Ref)
+ or else (Present (Associated_Node (Id_Ref))
+ and then Comes_From_Source
+ (Associated_Node (Id_Ref))))
+ then
+ Append_To (Args, New_Occurrence_Of (Standard_True, Loc));
end if;
-- Add discriminant values if discriminants are present
Make_Defining_Identifier (Loc,
New_External_Name (Chars
(Component_Type (Typ)), "_skip_null_excluding_check")),
+ Expression => New_Occurrence_Of (Standard_False, Loc),
In_Present => True,
Parameter_Type =>
New_Occurrence_Of (Standard_Boolean, Loc)));
--- /dev/null
+-- { dg-do compile }
+
+procedure Allocator is
+ type Object_Type is not null access all Integer;
+ type Object_Array is array (Positive range <>) of Object_Type;
+ type Object_Array_Ptr is access Object_Array;
+ type Data_Ptr is access Object_Array_Ptr;
+ Copy : Data_Ptr := new Object_Array_Ptr;
+begin
+ Copy.all := new Object_Array (1..2);
+end;