* gcc-interface/trans.c (push_range_check_info): Replace early test
[official-gcc.git] / gcc / testsuite / gnat.dg / opt45.adb
blobf75e46ed42d59acd6510770d104d2ad7106ae3ec
1 -- { dg-do compile }
2 -- { dg-options "-O3" }
4 procedure Opt45 is
6 type Index_T is mod 2 ** 32;
7 for Index_T'Size use 32;
8 for Index_T'Alignment use 1;
10 type Array_T is array (Index_T range <>) of Natural;
11 type Array_Ptr_T is access all Array_T;
13 My_Array_1 : aliased Array_T := (1, 2);
14 My_Array_2 : aliased Array_T := (3, 4);
16 Array_Ptr : Array_Ptr_T := null;
17 Index : Index_T := Index_T'First;
19 My_Value : Natural := Natural'First;
21 procedure Proc (Selection : Positive) is
22 begin
23 if Selection = 1 then
24 Array_Ptr := My_Array_1'Access;
25 Index := My_Array_1'First;
26 else
27 Array_Ptr := My_Array_2'Access;
28 Index := My_Array_2'First;
29 end if;
31 if My_Value = Natural'First then
32 My_Value := Array_Ptr.all (Index);
33 end if;
34 end;
36 begin
37 Proc (2);
38 end;