aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gnat.dg/opt14.adb
blob: 61bc7313bb5ea41f379991386e6965dee1e04ce0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
-- { dg-do run }
-- { dg-options "-O2" }

procedure Opt14 is

  type Rec is record
    I1, I2, I3 : Integer;
  end record;

  type Ptr is access Rec;

  P : Ptr := new Rec'(0,0,0);

  procedure Sub (R : In Out Rec) is
  begin
    R.I3 := R.I3 - 1;
  end;

begin
  P.all := (1,2,3);
  Sub (P.all);
  if P.all /= (1,2,2) then
    raise Program_Error;
  end if;
end;