Corrected date in changelog
[official-gcc.git] / gcc / testsuite / gnat.dg / loop_unchecked_conversion.adb
blobe87c415c5480efa8c367befbf4b4343a90e67419
1 -- { dg-do compile }
2 -- { dg-options "-gnatws -O" }
4 with Unchecked_Conversion;
6 package body loop_unchecked_conversion is
8 type Byte is mod 2**8;
10 type List is array (Natural range <>) of Byte;
12 subtype Integer_List is List (1 .. 4);
14 function Integer_Down is new
15 Unchecked_Conversion (Source => Integer, Target => Integer_List);
17 type Storage (Size : Integer) is
18 record
19 Data : List (1 .. Size);
20 end record;
22 type Storage_Pointer is access Storage;
24 The_Data_Storage : Storage_Pointer;
26 procedure slice is
27 begin
28 for I in 0 .. 1 loop
29 The_Data_Storage.Data (I+1 .. I+4) := Integer_Down (I);
30 end loop;
31 end;
33 end loop_unchecked_conversion;