Re: [PATCH 0/3] Work around icc miscompilation

Поиск
Список
Период
Сортировка
От Xi Wang
Тема Re: [PATCH 0/3] Work around icc miscompilation
Дата
Msg-id CAKU6vyZ9NnVdB46xtxWFYWHg2Syt+59fsA7+aCeXfTsP_uki6Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH 0/3] Work around icc miscompilation  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
It depends on the context.  In the patches, `a' is known to be
non-negative, so `INT_MAX - a' cannot overflow.  If you ignore the
context and talk about the general case, then it can.

- xi

On Sat, Feb 23, 2013 at 12:25 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Greg Stark <stark@mit.edu> writes:
>> He's changing things to do
>
>> if (INT_MAX - a > b)
>>   PG_THROW ("a+b would overflow")
>> else
>>   x=a+b;
>
>> Why would a smarter compiler be licensed to conclude that it can
>> optimize away anything? "INT_MAX-a > b" is always well defined.
>
> Really?  Can't "INT_MAX - a" overflow?
>
>                         regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH 0/3] Work around icc miscompilation
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: make: *** pg_xlogdump: No such file or directory. Stop.