Re: BUG #5592: list of integer undefined behaviors - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #5592: list of integer undefined behaviors
Date
Msg-id 6265.1280801341@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #5592: list of integer undefined behaviors  (Greg Stark <gsstark@mit.edu>)
Responses Re: BUG #5592: list of integer undefined behaviors
List pgsql-bugs
Greg Stark <gsstark@mit.edu> writes:
> On Mon, Aug 2, 2010 at 7:16 PM, John Regehr <regehr@cs.utah.edu> wrote:
>> <nabstime.c, (1193:21)> : Op: -, Reason : Signed Subtraction Overflow,
>> BINARY OPERATION: left (int32): 2147483644 right (int32): -2147483648
>>
>> <nabstime.c, (1194:21)> : Op: -, Reason : Signed Subtraction Overflow,
>> BINARY OPERATION: left (int32): 2147483644 right (int32): -2147483648

> These seem to imply that tinterval can contain a start point greater
> than its end point.

Just to follow up: all the other ones seem to be non-problems.
The one in bitmapset.c is an intentional trick (see the comment for
the RIGHTMOST_ONE macro), and all the ones in int.c and int8.c have
associated overflow checks.  I'm actually a bit surprised that the
regression tests seem to exercise all of those overflow checks ;-)

Like Greg, I'm not sure about the tinterval_cmp_internal cases.
tinterval is pretty much a dead legacy datatype anyway, but probably we
oughta fix it if there are failures showing up in the regression tests.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #5590: undefined shift behavior
Next
From: Tom Lane
Date:
Subject: Re: BUG #5592: list of integer undefined behaviors