2016-11-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
[official-gcc.git] / gcc / testsuite / gnat.dg / opt14.adb
blob61bc7313bb5ea41f379991386e6965dee1e04ce0
1 -- { dg-do run }
2 -- { dg-options "-O2" }
4 procedure Opt14 is
6 type Rec is record
7 I1, I2, I3 : Integer;
8 end record;
10 type Ptr is access Rec;
12 P : Ptr := new Rec'(0,0,0);
14 procedure Sub (R : In Out Rec) is
15 begin
16 R.I3 := R.I3 - 1;
17 end;
19 begin
20 P.all := (1,2,3);
21 Sub (P.all);
22 if P.all /= (1,2,2) then
23 raise Program_Error;
24 end if;
25 end;