Re: BUG #5592: list of integer undefined behaviors

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: John Regehr <regehr(at)cs(dot)utah(dot)edu>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5592: list of integer undefined behaviors
Date: 2010-08-03 02:09:01
Message-ID: 6265.1280801341@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Greg Stark <gsstark(at)mit(dot)edu> writes:
> On Mon, Aug 2, 2010 at 7:16 PM, John Regehr <regehr(at)cs(dot)utah(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-08-03 02:33:18 Re: BUG #5592: list of integer undefined behaviors
Previous Message Tom Lane 2010-08-03 01:31:49 Re: BUG #5590: undefined shift behavior