summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/test/opt/tgotoreg.pp
blob: 1e89b3b2d91251796c8c4388a6c2dc0f629933b9 (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
{ %OPT=-Ooregvar }

{$goto on}

var
  global: longint;

procedure t1;
begin
  { make sure it's not put in a register in t }
  global := 1;
end;

procedure t;
var
  l: longint;
  s1,s2,s3: ansistring;
label lab;
begin
  t1;
  l := 1;
  s1 := 'ABC';
  s2 := 'DEF';
  s3 := '';
lab:
  inc(l);
  inc(global);
  if global > 10 then
    halt(1);
  if l = 10 then
    s3 := 'ABCDEF';
  if s1+s2 <> s3 then
    goto lab;
end;

begin
  t;
end.