summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw7851.pp
blob: 9fa44882ae0c46195bae93c970e9f585da145136 (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
{ %cpu=i386,x86_64 }

program AsmCrash;

{$IFDEF FPC}
  {$mode delphi}
{$ENDIF}

uses
  sysutils;

type
  TMyRecord = record
    rField: Integer;
  end;

  TMyObject = class
  private
    oField: TMyRecord;
  public
    procedure Test;
    procedure Test2;
  end;

{ TMyObject }

var
  l: cardinal;

procedure TMyObject.Test;
asm
  call TMyObject.Test2
end;

procedure TMyObject.Test2;
begin
  l := $cafebabe;
end;

begin
  with TMyObject.Create do try
    Test;
    if l <> $cafebabe then
      halt(1);
    l := $deadbeef;
  finally
    Free;
  end;
  if l <> $deadbeef then
    halt(2);
end.