PR target/84336
[official-gcc.git] / gcc / testsuite / gnat.dg / self_aggregate_with_pointer.adb
blob179fe4e972276bec04455b05d3e57fdf52a40917
1 -- { dg-do run }
3 procedure self_aggregate_with_pointer is
5 type Arr is array (Natural range <>) of Integer;
7 type Rec (N : Natural) is record
8 A : Arr (1..N);
9 end record;
11 type Acc_Rec is access all Rec;
13 type SRec is record
14 A : Acc_Rec;
15 I1, I2, I3, I4, I5, I6, I7: Integer;
16 end record;
18 R : aliased Rec (1);
19 S : Srec := (A => R'Access, others => 0);
21 begin
22 S := (A => S.A, others => 0);
23 if S.A /= R'Access then
24 raise Program_Error;
25 end if;
26 end;