Tom Lane wrote:
> Bruce Momjian writes:
> > Consider improving overflow detection
> >*
> > http://archives.postgresql.org/message-id/4bc66a57.2030...@cs.utah.edu
>
> I did look at those at the time, and saw absolutely no reason to prefer
> them over what we do now.
OK, removed from
Bruce Momjian writes:
> Consider improving overflow detection
> *
> http://archives.postgresql.org/message-id/4bc66a57.2030...@cs.utah.edu
I did look at those at the time, and saw absolutely no reason to prefer
them over what we do now.
regards, tom lane
John Regehr wrote:
> Hi Tom,
>
> > If you can show me rewrites of all the basic arithmetic operations that
> > detect overflow in full compliance with the C standard, and are
> > readable, portable, and efficient, I'm all ears.
>
> These are the best ones that I know of:
>
> https://www.secureco
Hi Tom,
> If you can show me rewrites of all the basic arithmetic operations that
> detect overflow in full compliance with the C standard, and are
> readable, portable, and efficient, I'm all ears.
These are the best ones that I know of:
https://www.securecoding.cert.org/confluence/display/secc
John Regehr writes:
> Hi Tom,
>> None of these proposals are improvements over what's there. The
>> fundamental problem is that if the compiler chooses to believe that
>> overflow doesn't exist, it can optimize away *any* test that could only
>> succeed in overflow cases. Finding a form of the t
Hi Tom,
Note that we recommend using -fwrapv with gcc, so that it doesn't break
code that depends on this type of test. (If int4inc isn't working then
there are probably a lot of other places that are broken too.) I imagine
LLVM has the same or similar switch.
llvm-gcc has the -fwrapv flag,
"John Regehr" writes:
> The overflow check in int4inc() from int.c is wrong.
Hm, works for me:
regression=# \set VERBOSITY verbose
regression=# select int4inc(2147483647);
ERROR: 22003: integer out of range
LOCATION: int4inc, int.c:768
> The problem is that in
> C, signed overflow is undefine
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 wro