summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/test/opt/treg4.pp
blob: cdd5dd7a94a40f0c949fc415e6cd5c42271a7ef3 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{$inline on}
{$mode objfpc}

type
  tr = record
    case byte of
      1: (l: longint);
      2: (b1,b2,b3,b4: byte);
  end;

function f: tr; inline;
begin
  f.l := 5;
  f.b3 := 6;
end;

procedure t(const r1: tr);
begin
  if (r1.b3 <> 6) or
     ((r1.l and 255) <> 5) then
    halt(1);
end;

procedure t2(out r: tr); inline;
begin
  r.l := 7;
  r.b2 := 31;
end;

procedure t3(out r: tr); inline;
begin
  r.l := 88;
  r.b2 := 9;
end;

procedure t4(out r: tr);
begin
  t3(r);
end;


var
  r: tr;
begin
  t(f);
  t2(r);
  if ((r.l and 255) <> 7) or
     (r.b2 <> 31) then
    halt(1);
  t4(r);
  if ((r.l and 255) <> 88) or
     (r.b2 <> 9) then
    halt(1);
end.