aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/opt39.adb
blob: 0a5ef67a2edcf08b607489cebdf0bcb0bd073760 (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-not "MEM" "optimized" } }
-- { dg-final { scan-tree-dump-not "tmp" "optimized" } }