OSDN Git Service

* gnat.dg/in_out_parameter.adb: New test.
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Sep 2006 14:24:22 +0000 (14:24 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Sep 2006 14:24:22 +0000 (14:24 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116945 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/in_out_parameter.adb [new file with mode: 0644]

index ce08250..929e76f 100644 (file)
@@ -1,3 +1,7 @@
+2006-09-14  Olivier Hainque  <hainque@adacore.com>
+
+       * gnat.dg/in_out_parameter.adb: New test.
+
 2006-09-13  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR debug/28980
diff --git a/gcc/testsuite/gnat.dg/in_out_parameter.adb b/gcc/testsuite/gnat.dg/in_out_parameter.adb
new file mode 100644 (file)
index 0000000..c936ec1
--- /dev/null
@@ -0,0 +1,38 @@
+-- { dg-do run }
+
+with Ada.Streams.Stream_IO;
+
+procedure In_Out_Parameter is
+
+   use Ada.Streams;  use Stream_IO;
+
+   File : Stream_IO.File_Type;
+
+   type Bitmap is array (Natural range <>) of Boolean;
+   for Bitmap'Component_Size use 1;
+
+   type Message   is record
+      B : Bitmap (0 .. 14);
+   end record;
+   for Message use record
+      B  at 0 range 2 .. 16;
+   end record;
+
+   TX, RX : Message;
+
+begin
+
+   TX.B  := (others => False);
+   Stream_IO.Create (File => File, Mode => Out_File, Name => "data");
+   Message'Output (Stream (File), TX);
+   Stream_IO.Close (File);
+   --
+   Stream_IO.Open (File => File, Mode => In_File, Name => "data");
+   RX := Message'Input (Stream (File));
+   Stream_IO.Close (File);
+
+   if RX /= TX then
+      raise Program_Error;
+   end if;
+
+end In_Out_Parameter;