Revert the last commit.
[official-gcc/graphite-test-results.git] / gcc / testsuite / gnat.dg / slice7.adb
blob3f0d3f5b3fc94bb8feaa110b37c2dbfe96242aab
1 -- { dg-do compile }
2 -- { dg-options "-gnatws" }
4 with System.Storage_Elements; use System.Storage_Elements;
5 with Unchecked_Conversion;
6 with Slice7_Pkg; use Slice7_Pkg;
8 procedure Slice7 is
10 type Discrete_Type is range 1 .. 32;
12 Max_Byte_Count : constant := 4;
13 subtype Byte_Count_Type is Storage_Offset range 1..Max_Byte_Count;
15 subtype Buffer_Type is Storage_Array (Byte_Count_Type);
16 function Convert_Put is new Unchecked_Conversion (Integer, Buffer_Type);
18 function Set_Buffer_Size return Byte_Count_Type is
19 begin
20 return 4;
21 end;
23 Buffer_Size : constant Byte_Count_Type := Set_Buffer_Size;
24 Buffer_End : constant Byte_Count_Type := Max_Byte_Count;
25 Buffer_Start : constant Byte_Count_Type := Buffer_End - Buffer_Size + 1;
27 Obj : Discrete_Type;
29 begin
30 Put (Convert_Put(Discrete_Type'Pos (Obj))
31 (Buffer_Start..Buffer_End));
33 Put (Convert_Put(Discrete_Type'Pos (Obj) -
34 Discrete_Type'Pos (Discrete_Type'First))
35 (Buffer_Start..Buffer_End));
36 end;