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

2017-12-17 Thread Tom Lane
Michael Paquier 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

pgsql: Try harder to detect unavailability of __builtin_mul_overflow(in

2017-12-17 Thread Tom Lane
Try harder to detect unavailability of __builtin_mul_overflow(int64). Commit c04d35f44 didn't quite do the job here, because it still allowed the compiler to deduce that the function call could be optimized away. Prevent that by putting the arguments and results in global variables. Discussion:

Re: pgsql: Use new overflow aware integer operations.

2017-12-17 Thread Tom Lane
David Rowley writes: > I notice it's caused a small warning in compilers that don't > understand about elog(ERROR) and ereport(ERROR) not returning. Wups, I noticed this independently and fixed it before reading your message. Sorry about failing to credit you in the commit log.

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

2017-12-17 Thread Michael Paquier
On Mon, Dec 18, 2017 at 1:03 AM, Tom Lane wrote: > Michael Paquier 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 te