Re: pgsql: Provide overflow safe integer math inline functions.

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael.paquier@gmail.com>, pgsql-committers@postgresql.org
Date: 2017-12-18T16:40:06Z
Lists: pgsql-hackers
On 2017-12-17 11:03:49 -0500, Tom Lane wrote:
> Michael Paquier <michael.paquier@gmail.com> writes:
> > ... Please note that if you added
> > a volatile cast to "result" as well, then compilation was able to
> > complete and regression tests passed...
> 
> Yeah, that squares with my analysis: the problem with the existing test
> is that the compiler is throwing away the function call because its
> output is unused.
> 
> If I haven't seen something from Andres shortly, I'll push a fix.

Thanks! Was off for most of yesterday...

Greetings,

Andres Freund


Commits

  1. Try harder to detect unavailability of __builtin_mul_overflow(int64).

  2. Try to detect runtime unavailability of __builtin_mul_overflow(int64).

  3. Fix a number of copy & paste comment errors in common/int.h.

  4. Provide overflow safe integer math inline functions.