[fpc-devel]Re: Latest status
Stefan Ziegenbalg
stefan.ziegenbalg at mailbox.tu-dresden.de
Mon Nov 26 19:17:40 CET 2001
Pierre Muller wrote:
>
> You will get troubles anyway if address arithmetic is wrong:
>
> - on linux the stack is often above the 0x80000000,
Yes, it depends on the kernel (settings). (Here stack starts/ends at
$C0000000 )
> So any error in using signed operation could
> already break small program...
What I mean with "address arithemtic" is this:
var i : longint;
m,l : ^longint;
begin
...
i:=1234;
m[i]:=l[i*6+5678];
end.
It's not possible to control how "i*6+5678" is calculated. The compiler
translates this example to:
movl $1234,_I
movl _M,%eax
movl _I,%edx
movl _L,%ebx
movl _I,%ecx
imull $6,%ecx
addl $5678,%ecx
movl (%ebx,%ecx,4),%edi
movl %edi,(%eax,%edx,4)
That means integer multiply. But in this case signed and unsigned
multiply should be the same ("mul reg,mem" does not exist).
So in this example it should be possible to access more then 2GB.
Best regards,
Stefan
--
mailto:stefan.ziegenbalg at mailbox.tu-dresden.de
http://www.simage.org
More information about the fpc-devel
mailing list