Re: 64-bit integer subtraction bug on some platforms

2023-11-08 Thread Tom Lane
Laurenz Albe writes: > On Wed, 2023-11-08 at 11:58 +, Dean Rasheed wrote: >> This should overflow, since the correct result (+9223372036854775808) >> is out of range. However, on platforms without integer overflow >> builtins or 128-bit integers, pg_sub_s64_overflow() does the >> following:

Re: 64-bit integer subtraction bug on some platforms

2023-11-08 Thread Laurenz Albe
On Wed, 2023-11-08 at 11:58 +, Dean Rasheed wrote: > One of the new tests in the infinite interval patch has revealed a bug > in our 64-bit integer subtraction code. Consider the following: > > select 0::int8 - '-9223372036854775808'::int8; > > This should overflow, since the correct result

64-bit integer subtraction bug on some platforms

2023-11-08 Thread Dean Rasheed
One of the new tests in the infinite interval patch has revealed a bug in our 64-bit integer subtraction code. Consider the following: select 0::int8 - '-9223372036854775808'::int8; This should overflow, since the correct result (+9223372036854775808) is out of range. However, on platforms