On 02 Oct 2009, at 12:48, JoshyFun wrote:

That's exactly my supposition, the problem raises as the quotient
should never be negative, but due unexpected flow, it takes a -1 value
instead zero (already fixed) but no problem in 32 bits using integer
and DWORD instead int64 and QWORD.

In the other hand the question is if that pascal code should work or
raise an error in 64 bits because I think that this code:

a := NativeInteger div NativeUnsignedInteger;

should have the same behaviour in 32 and 64 bits, so I do not know if
I must fill a bug report or not :-?

It is not possible to have the same behaviour in 32 and 64 bits until the compiler supports 128 bit arithmetic. The compiler can convert "longint div cardinal" to "int64 div int64", but in case of "int64 div qword" it must either convert the int64 to qword, or the qword to int64. Range checking should catch such errors.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to