[fpc-devel] Issue with inline assembler
Sergei Gorelkin
sergei_gorelkin at mail.ru
Mon Nov 20 17:48:52 CET 2006
Hello,
I had encountered an unpleasant issue while trying to compile Delphi
code that uses inline assembler. The code looks like this:
===
{$asmmode intel}
type
TMyObject = class(TObject)
public
procedure DoSomething;
procedure DoSomethingElse(a, b: Integer);
end;
procedure TMyObject.DoSomething;
begin
SomeStuff;
asm
// here put some values into edx and ecx
mov eax, self
call TMyObject.DoSomethingElse
end;
SomeMoreStuff;
end;
===
In Delphi, everything is ok. In FPC, it compiles without errors, but
crashes at runtime. Producing an assembler listing with
'fpc -aMASM -s file.pas' shows that the line 'call TMyObject.DoSomethingElse' is
translated into 'call 0' (yes, with literal zero). IMO this shouldn't
be so - it must either produce correct address or produce a error
during compilation (first case being preferred for Delphi
compatibility).
Should I report this as bug?
--
Best regards,
Sergei
More information about the fpc-devel
mailing list