I'm not quite sure what you think is wrong with this code (from the fpc
viewpoint):
# [31] WriteLn(master.getVersion());
call fpc_get_output
movq %rax,%rbx
movq U_P$CREATE_MASTER,%rdi
movq U_P$CREATE_MASTER,%rax
movq (%rax),%rax
call *(%rax)
movl %eax,%edx
movslq %edx,%rdx
movq %rbx,%rsi
movl $0,%edi
call fpc_write_text_sint
call FPC_IOCHECK
movq %rbx,%rdi
call fpc_writeln_end
call FPC_IOCHECK
As far as I can make out, it is loading the instance variable (Master)
into %rdi
movq U_P$CREATE_MASTER,%rdi
It then assumes a simple vtable and loads and calls the first pointer
in the table:
movq U_P$CREATE_MASTER,%rax
movq (%rax),%rax
call *(%rax)
On return, the result is assumed to be in $eax (standard cdecl for a
32-bit integer return), and then, after a "sign extend" to 64-bit passes
it on to the writeln:
movl %eax,%edx
movslq %edx,%rdx
movq %rbx,%rsi
movl $0,%edi
call fpc_write_text_sint
It would be interesting to see what the c++ compiler expected, but my
guess is that it does not use %rdi for the instance variable.
On 14/08/14 12:28, Dimitry Sibiryakov wrote:
> 14.08.2014 11:34, Alex Peshkoff wrote:
>> HP C/aC++ Version A.06.26
>
> Alpha version?..
>
> PS: The problem with FPC which started whole this topic seems to be a
> compiler's bug which destroy value returning by external function.
> Testcase is attached. I registered ticket in their bugtracker:
> http://bugs.freepascal.org/view.php?id=26593.
>
>
>
> ------------------------------------------------------------------------------
>
>
> Firebird-Devel mailing list, web interface at
> https://lists.sourceforge.net/lists/listinfo/firebird-devel
------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel