This is an incorrect node sharing for allocators built for a discriminated
type with default values.
gcc/ada/
PR ada/110314
* sem_ch4.adb (Analyze_Allocator): Add call to New_Copy_Tree.
gcc/testsuite/
* gnat.dg/allocator3.adb: New test.
begin
while Present (Discr) loop
- Append (Discriminant_Default_Value (Discr), Constr);
+ Append_To (Constr,
+ New_Copy_Tree (Discriminant_Default_Value (Discr)));
Next_Discriminant (Discr);
end loop;
--- /dev/null
+-- { dg-do compile }
+
+with Ada.Containers.Synchronized_Queue_Interfaces;
+with Ada.Containers.Unbounded_Synchronized_Queues;
+
+procedure Allocator3 is
+
+ package Queue_Interfaces is
+ new Ada.Containers.Synchronized_Queue_Interfaces (Integer);
+
+ package Synchronized_Queues is
+ new Ada.Containers.Unbounded_Synchronized_Queues (Queue_Interfaces);
+
+ subtype Queue is Synchronized_Queues.Queue;
+
+ type Access_Type is access all Queue;
+
+ Q1 : Access_Type := new Queue;
+ Q2 : Access_Type := new Queue;
+
+begin
+ null;
+end;