Preserving locations for variable-uses and constants (PR c++/43486)
[official-gcc.git] / gcc / testsuite / gnat.dg / opt39.adb
blob3b12cf201ec9c22d6add13404221985bb2038217
1 -- { dg-do compile }
2 -- { dg-options "-O2 -fno-inline -fdump-tree-optimized" }
4 procedure Opt39 (I : Integer) is
6 type Rec is record
7 I1 : Integer;
8 I2 : Integer;
9 I3 : Integer;
10 I4 : Integer;
11 I5 : Integer;
12 end record;
14 procedure Set (A : access Rec; I : Integer) is
15 Tmp : Rec := A.all;
16 begin
17 Tmp.I1 := I;
18 A.all := Tmp;
19 end;
21 R : aliased Rec;
23 begin
24 Set (R'Access, I);
25 if R.I1 /= I then
26 raise Program_Error;
27 end if;
28 end;
30 -- { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } }