summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw8153.pp
blob: d1341aab7c2648e4a6716d549f9d3f24190096f8 (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
{ %cpu=i386 }

{$ifdef fpc}
{$mode delphi}
{$endif}

type
  tc = class
    procedure v; virtual;
    procedure testintel; virtual;
    procedure testatt; virtual;
  end;

procedure tc.testintel; assembler; nostackframe;
asm
  mov ecx,[eax]
  jmp [ecx + vmtoffset tc.v]
end;

{$asmmode att}

procedure tc.testatt; assembler; nostackframe;
asm
  movl (%eax),%ecx
  jmpl +vmtoffset tc.v(%ecx)
end;

var
  l : longint;

procedure tc.v;
begin
  l := 5;
end;

var
  c: tc;
begin
  c := tc.create;
  c.testintel;
  if l <> 5 then
    halt(1);
  l := 0;
  c.testatt;
  if l <> 5 then
    halt(1);
  c.free;
end.