1-- { dg-do run } 2 3procedure self_aggregate_with_pointer is 4 5 type Arr is array (Natural range <>) of Integer; 6 7 type Rec (N : Natural) is record 8 A : Arr (1..N); 9 end record; 10 11 type Acc_Rec is access all Rec; 12 13 type SRec is record 14 A : Acc_Rec; 15 I1, I2, I3, I4, I5, I6, I7: Integer; 16 end record; 17 18 R : aliased Rec (1); 19 S : Srec := (A => R'Access, others => 0); 20 21begin 22 S := (A => S.A, others => 0); 23 if S.A /= R'Access then 24 raise Program_Error; 25 end if; 26end; 27