Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-11

Issue with inline assembler

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Sergei Gorelkin

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 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

Reply by email