PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gnat.dg / discr33.adb
blobe667e7f27815b87013a1fc736073be1a0d101fb7
1 -- { dg-do run }
3 procedure Discr33 is
5 subtype Int is Integer range 1..100;
7 type T (D : Int := 1) is
8 record
9 A : Integer;
10 B : String (1..D);
11 C : aliased Integer;
12 end record;
14 Var : T := (D => 1, A => 1234, B => "x", C => 4567);
16 type Int_Ref is access all Integer;
17 Pointer_To_C : Int_Ref := Var.C'Access;
19 begin
21 if Pointer_To_C.all /= 4567 then
22 raise Program_Error;
23 end if;
25 Var := (D => 26, A => 1234, B => "abcdefghijklmnopqrstuvwxyz", C => 2345);
27 if Pointer_To_C.all /= 2345 then
28 raise Program_Error;
29 end if;
31 end Discr33;