Re: fix for strict-alias warnings

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: fix for strict-alias warnings
Дата
Msg-id 6174.1066106240@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: fix for strict-alias warnings  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> I don't think we understand the dangers quite yet, and I think the
>> patches applied to date constitute useless thrashing rather than fixes.

> In reading http://www.gnu.org/software/gcc/bugs.html#nonbugs_c and the
> link it references,
> http://mail-index.netbsd.org/tech-kern/2003/08/11/0001.html, they seem
> to be talking about any pointer casting.

The latter reference makes it absolutely crystal-clear that inserting
void* casts does *not* fix the issue.  Also observe the statement

> gcc may warn for some constructs that break the aliasing rules, but not
> all of them (or not even most of them!), so a warning-free source code
> does not give you any guarantee.

I have to agree now with Andrew's last mail that -fno-strict-aliasing is
the only safe solution.  Since gcc isn't even pretending that it can
warn in all cases where the optimization might break things, I'm not
sure we could ever responsibly enable this optimization.  I do not feel
this is our problem; it is the compiler hackers' fault if they need to
make unsupportable, untestable assumptions about application code.

Basically, ISO broke the language here, and I say it's a screwup up with
which we need not put.

            regards, tom lane

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: fix for strict-alias warnings
Следующее
От: "Andrew Dunstan"
Дата:
Сообщение: Re: fix for strict-alias warnings