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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: 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-17 01:31:01
Message-ID: 22109.1513474261@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> I'm not quite following. Could you check if the same happens without
> -O2? Not because that'd be a solution, but to narrow down how this
> happens?

The committed test looks quite broken to me: it's missing some &
operators. Not sure how that translates into failing to fail the
configure test, but personally I'd have done this like

volatile PG_INT64_TYPE a = 1;
volatile PG_INT64_TYPE b = 1;
PG_INT64_TYPE result;
__builtin_mul_overflow(a, b, &result);

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2017-12-17 01:35:05 Re: pgsql: Provide overflow safe integer math inline functions.
Previous Message Andres Freund 2017-12-17 00:32:07 Re: pgsql: Provide overflow safe integer math inline functions.

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-12-17 01:35:05 Re: pgsql: Provide overflow safe integer math inline functions.
Previous Message Andres Freund 2017-12-17 00:32:07 Re: pgsql: Provide overflow safe integer math inline functions.