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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgsql: Provide overflow safe integer math inline functions.
Дата
Msg-id 23537.1513475312@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgsql: Provide overflow safe integer math inline functions.  (Andres Freund <andres@anarazel.de>)
Список pgsql-committers
Andres Freund <andres@anarazel.de> writes:
> On December 16, 2017 5:31:01 PM PST, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 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,

> Hm, true. As you say, it doesn't explain the problem though, it's just weird int  to ptr cases. Kinda seems like
clanglinks to a different runtime during the configure tests than what's used for postgres... 

What I'm thinking is that that somehow prevents the "volatile" from
having any effect.  On my laptop (recent Apple clang), the function call
certainly does seem to get optimized away with the test-as-committed...

Oh!  It seems to get optimized away with my "volatile" version too.

I think the real issue, or part of it, is that you need to assign the
result to a global variable, not a local one, so that the compiler
doesn't decide it can forget the whole thing.  And maybe store the
bool result somewhere, too.

Marking the result and bool-result variables as volatile might
be an OK substitute for making them global.  But the global way
is what we've done in older configure test programs.

            regards, tom lane


В списке pgsql-committers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pgsql: Provide overflow safe integer math inline functions.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Suppress compiler warning about no function return value.