OSDN Git Service

fix PR tag
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gnat.dg / in_out_parameter3.adb
1 -- { dg-do run }
2 -- { dg-options "-gnat12" }
3
4 procedure In_Out_Parameter3 is
5
6   type Arr is array (1..16) of Integer;
7
8   type Rec1 is record
9     A : Arr;
10     B : Boolean;
11   end record;
12
13   type Rec2 is record
14     R : Rec1;
15   end record;
16   pragma Pack (Rec2);
17
18   function F (I : In Out Rec1) return Boolean is
19     A : Integer := I.A (1);
20   begin
21     I.A (1) := I.A (1) + 1;
22     return (A > 0);
23   end;
24
25   I : Rec2 := (R => (A => (others => 0), B => True));
26   B : Boolean;
27
28 begin
29   B := F (I.R);
30   if B then
31     raise Program_Error;
32   end if;
33   if I.R.A (1) /= 1 then
34     raise Program_Error;
35   end if;
36   if F (I.R) = False then
37      raise Program_Error;
38   end if;
39   if I.R.A (1) /= 2 then
40     raise Program_Error;
41   end if;
42 end;