Hello FPC-Pascal, Friday, October 2, 2009, 1:38:30 AM, you wrote:
MK> I compiled this with fpc -al .. under linux 64. MK> The difference is, "r := <integer> div <qword>" results in an "divq" MK> instruction wich is for unsigned integer division only. "r := MK> <integer> div <int64>" results in "idivq" which is for signed integer MK> division. MK> On execution this results in an error (i've got divbyzero on amd64) MK> for the first one, which is a result of the signed/unsigned integer MK> conversion and division mix. MK> Short: Use int64 types for the signed division for quotient and divisor 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 :-? Thank you for your help. -- Best regards, JoshyFun _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal