Re: [BUGS] BUG #5592: list of integer undefined behaviors

2010-08-03 Thread John Regehr
On 8/3/2010 4:08 PM, Tom Lane wrote: However, most of the cases that seem of interest so far are in fairly small, stable functions. Would it be reasonable to attach a "checked for overflow problems" label to these functions as a whole? This should work great. I'll get my clang hacker to start

Re: [BUGS] BUG #5592: list of integer undefined behaviors

2010-08-03 Thread John Regehr
On 8/3/2010 3:43 PM, Tom Lane wrote: John Regehr writes: Just to follow up: all the other ones seem to be non-problems. Would you folks be willing to specify which arithmetic operations are considered to be safe in the case of overflow? Something simple like an "INTEGER_OVERFLOW_OK

Re: [BUGS] BUG #5592: list of integer undefined behaviors

2010-08-03 Thread John Regehr
operation would suffice. This would let me automatically filter out error messages on these lines of code in the future. John Regehr -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs

[BUGS] BUG #5592: list of integer undefined behaviors

2010-08-02 Thread John Regehr
The following bug has been logged online: Bug reference: 5592 Logged by: John Regehr Email address: reg...@cs.utah.edu PostgreSQL version: head 8/1/10 Operating system: OSX Description:list of integer undefined behaviors Details: Below: a list of integer undefined

Re: [BUGS] BUG #5590: undefined shift behavior

2010-08-02 Thread John Regehr
Aha-- the -fwrapv flag (which I had though was a nop) screws up our checks. Another rough edge to fix. Removing this flag caused us to find a bunch of integer overflows. I'll start reporting them later today. John -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make chang

Re: [BUGS] BUG #5590: undefined shift behavior

2010-08-02 Thread John Regehr
d expect our integer-checked binaries to be pretty efficient once this is all working. John On 8/2/2010 10:16 AM, Tom Lane wrote: John Regehr writes: On 08/02/2010 09:06 AM, Tom Lane wrote: John: how did you detect this? One of my students has hacked Clang to detect integer undefined

Re: [BUGS] BUG #5590: undefined shift behavior

2010-08-02 Thread John Regehr
Hrm, I'd have expected you to see a few integer overflows during the regression tests --- we do test that the overflow checks in places like int4pl work. I saw no signed overflows. Our patch still has some rough edges, but this part is pretty well tested. Perhaps the int4pl checks fire befor

Re: [BUGS] BUG #5590: undefined shift behavior

2010-08-02 Thread John Regehr
be able to find more problems if I could get hold of a good fuzz tester for postgresql, or at least some much larger test inputs. Are there any of these you folks would suggest that I use? Thanks, John On 08/02/2010 09:06 AM, Tom Lane wrote: > "John Regehr" writes: >> Bug

[BUGS] BUG #5590: undefined shift behavior

2010-08-02 Thread John Regehr
The following bug has been logged online: Bug reference: 5590 Logged by: John Regehr Email address: reg...@cs.utah.edu PostgreSQL version: head 8/2/10 Operating system: OSX Description:undefined shift behavior Details: During a "make check" the left-shif

Re: [BUGS] BUG #5416: int4inc() is wrong

2010-04-15 Thread John Regehr
luence/display/seccode/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow Even if you dislike these, please take a look at the safety checks for shifts. The current postgresql shift functions need to be strengthened, and it is easy to do. John Regehr -- Sent via pgsql-bug

Re: [BUGS] BUG #5416: int4inc() is wrong

2010-04-14 Thread John Regehr
ed behavior for any argument value. Therefore, any compiler which removes the test is wrong. Both the GCC and LLVM groups will be happy to fix a bug of that kind if it exists. Thanks, John Regehr -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subs

[BUGS] BUG #5416: int4inc() is wrong

2010-04-13 Thread John Regehr
The following bug has been logged online: Bug reference: 5416 Logged by: John Regehr Email address: reg...@cs.utah.edu PostgreSQL version: git head Apr 12 Operating system: n/a Description:int4inc() is wrong Details: The overflow check in int4inc() from int.c is