+2018-07-16 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Allocator): Test for Storage_Pool being RTE in
+ addition to the existing test for no Storage_Pool as a condition
+ enabling generation of the call to Check_Standard_Allocator when the
+ restriction No_Standard_Allocators_After_Elaboration is active.
+ * libgnat/s-elaall.ads (Check_Standard_Allocator): Correct comment to
+ say that Storage_Error will be raised (rather than Program_Error).
+ * libgnat/s-elaall.adb (Check_Standard_Allocator): Raise Storage_Error
+ rather than Program_Error when Elaboration_In_Progress is False.
+
2018-07-16 Gary Dismukes <dismukes@adacore.com>
* sem_eval.adb: Fix spelling for compile-time-known.
end if;
end if;
- -- If no storage pool has been specified and we have the restriction
+ -- If no storage pool has been specified, or the storage pool
+ -- is System.Pool_Global.Global_Pool_Object, and the restriction
-- No_Standard_Allocators_After_Elaboration is present, then generate
-- a call to Elaboration_Allocators.Check_Standard_Allocator.
if Nkind (N) = N_Allocator
- and then No (Storage_Pool (N))
+ and then (No (Storage_Pool (N))
+ or else Is_RTE (Storage_Pool (N), RE_Global_Pool_Object))
and then Restriction_Active (No_Standard_Allocators_After_Elaboration)
then
Insert_Action (N,
procedure Check_Standard_Allocator is
begin
if not Elaboration_In_Progress then
- raise Program_Error with
+ raise Storage_Error with
"standard allocator after elaboration is complete is not allowed "
& "(No_Standard_Allocators_After_Elaboration restriction active)";
end if;
procedure Check_Standard_Allocator;
-- Called as part of every allocator in a program for which the restriction
-- No_Standard_Allocators_After_Elaboration is active. This will raise an
- -- exception (Program_Error with an appropriate message) if it is called
+ -- exception (Storage_Error with an appropriate message) if it is called
-- after the call to Mark_End_Of_Elaboration.
end System.Elaboration_Allocators;