Hi, I compiled this with fpc -al .. under linux 64. The difference is, "r := <integer> div <qword>" results in an "divq" instruction wich is for unsigned integer division only. "r := <integer> div <int64>" results in "idivq" which is for signed integer division. On execution this results in an error (i've got divbyzero on amd64) for the first one, which is a result of the signed/unsigned integer conversion and division mix.
Short: Use int64 types for the signed division for quotient and divisor On Mon, Sep 28, 2009 at 9:31 PM, JoshyFun <joshy...@gmail.com> wrote: > Hello FPC-Pascal, > > Can anybody explain me if this code is expected to fail with a SIGFPE > in 64 bits windows 2.2.4 fpc: > > procedure test; > var > i6: int64; > qw: QWord; > r: int64; > begin > i6:=40; > qw:=40; > r:=(integer(-1)*i6) div qw; > end; > > Replacing "qw" with an int64 runs fine. > > -- > Best regards, > JoshyFun > > _______________________________________________ > fpc-pascal maillist - fpc-pas...@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal