2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gnat.dg / loop_address2.adb
blobaa955d771b21768c3a12646e5fa61f800d30759a
1 -- { dg-do compile }
2 -- { dg-options "-O" }
4 with System, Ada.Unchecked_Conversion;
5 with System.Storage_Elements; use System.Storage_Elements;
7 procedure Loop_Address2 is
9 type Ptr is access all Integer;
11 function To_Ptr is new Ada.Unchecked_Conversion (System.Address, Ptr);
13 function F (BM : System.Address; I : Integer) return System.Address is
14 begin
15 return BM + Storage_Offset (4*I);
16 end;
18 B : Integer;
19 P : Ptr;
21 begin
22 for I in 0 .. 2 loop
23 P := To_Ptr (F (B'Address, I));
24 P.all := 0;
25 end loop;
26 end ;