[fpc-devel] Unexpected range check error (64-bit only)
Jonas Maebe
jonas at freepascal.org
Thu Dec 30 13:05:44 CET 2021
On 28/12/2021 22:51, Bart via fpc-devel wrote:
> On Tue, Dec 28, 2021 at 9:38 PM Jonas Maebe via fpc-devel
> <fpc-devel at lists.freepascal.org> wrote:
>
>> https://gitlab.com/freepascal.org/fpc/source/-/issues/37875
> OK, but from reading that it is still unclear to me wether this is a bug or not.
It's something that is annoying, but impossible to fix in all cases
without adding support for 128 bit (or at least 65 bit) arithmetic. It's
what you get in exchange for support for unsigned arithmetic at the
highest available bit width. It could be considered a bug if the
behaviour is different from Delphi, but then we need the rules to
follow/implement.
> Nor why it only triggers with Byte + Byte + Unsigned, and not with
In you original mail, you said it triggered for Byte + Byte + Signed.
> Byte + Unsigned.
It doesn't trigger for Byte + *Signed* because that expression gets
evaluated as a signed expression. It would trigger an overflow for Byte
+ Int64 where the Int64 contains high(int64) and the byte a non-zero
value though (because it will overflow int64 in that case).
Jonas
More information about the fpc-devel
mailing list