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

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Subject: Re: pgsql: Provide overflow safe integer math inline functions.
Date: 2017-12-13 21:37:54
Message-ID: 20171213213754.pydkyjs6bt2hvsdb@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Hi Michael,

On 2017-12-13 01:01:19 +0000, Andres Freund wrote:
> Provide overflow safe integer math inline functions.

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=dangomushi&dt=2017-12-13%2018%3A00%3A18

which seems half like a compiler bug to me. But either way, we gotta
work around it. I suspect the reason configure test doesn't
sufficiently detect this here is because it's testing the function with
constant arguments.

Could you perhaps test whether replacing PGAC_C_BUILTIN_OP_OVERFLOW's body with something like
result
PG_INT64_TYPE a;
PG_INT64_TYPE b;
PG_INT64_TYPE result;
__builtin_mul_overflow(*(volatile PG_INT64_TYPE*) &a, *(volatile PG_INT64_TYPE*) &b, &result);

makes it fail? I'd rather not test this via the buildfarm, given that
dangomushi isn't the most frequently running / fastest animal.

- Andres

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2017-12-13 23:56:00 pgsql: Add pg_attribute_always_inline.
Previous Message Andres Freund 2017-12-13 21:32:24 pgsql: Add defenses against pre-crash files to BufFileOpenShared().

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2017-12-13 21:45:45 Re: heap/SLRU verification, relfrozenxid cut-off, and freeze-the-dead bug (Was: amcheck (B-Tree integrity checking tool))
Previous Message Robert Haas 2017-12-13 21:35:04 Re: [HACKERS] parallel.c oblivion of worker-startup failures