aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gnat.dg/opt39.adb
blob: a00cac75fb54b783928ca2e628228e484bffdb6e (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
26
27
28
29
30
31
-- { dg-do compile }
-- { dg-options "-O2 -fno-inline -fdump-tree-optimized" }

procedure Opt39 (I : Integer) is

  type Rec is record
    I1 : Integer;
    I2 : Integer;
    I3 : Integer;
    I4 : Integer;
    I5 : Integer;
  end record;

  procedure Set (A : access Rec; I : Integer) is
    Tmp : Rec := A.all;
  begin
    Tmp.I1 := I;
    A.all := Tmp;
  end;

  R : aliased Rec;

begin
  Set (R'Access, I);
  if R.I1 /= I then
    raise Program_Error;
  end if;
end;

-- { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } }
-- { dg-final { cleanup-tree-dump "optimized" } }