2018-03-15 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gnat.dg / in_out_parameter.adb
blobc936ec1e7e6f2e9d516d39fa03796bcf07a06a9d
1 -- { dg-do run }
3 with Ada.Streams.Stream_IO;
5 procedure In_Out_Parameter is
7 use Ada.Streams; use Stream_IO;
9 File : Stream_IO.File_Type;
11 type Bitmap is array (Natural range <>) of Boolean;
12 for Bitmap'Component_Size use 1;
14 type Message is record
15 B : Bitmap (0 .. 14);
16 end record;
17 for Message use record
18 B at 0 range 2 .. 16;
19 end record;
21 TX, RX : Message;
23 begin
25 TX.B := (others => False);
26 Stream_IO.Create (File => File, Mode => Out_File, Name => "data");
27 Message'Output (Stream (File), TX);
28 Stream_IO.Close (File);
30 Stream_IO.Open (File => File, Mode => In_File, Name => "data");
31 RX := Message'Input (Stream (File));
32 Stream_IO.Close (File);
34 if RX /= TX then
35 raise Program_Error;
36 end if;
38 end In_Out_Parameter;