Re: [PATCHES] fix for strict-alias warnings - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: [PATCHES] fix for strict-alias warnings
Date
Msg-id 002801c3917b$b35ff0c0$6401a8c0@DUNSLANE
Whole thread Raw
Responses Re: [PATCHES] fix for strict-alias warnings
List pgsql-hackers
[moved to hackers]

----- Original Message ----- 
From: "Tom Lane" <tgl@sss.pgh.pa.us>
>
> I don't think we understand the dangers quite yet, and I think the
> patches applied to date constitute useless thrashing rather than fixes.
> I'd like to see less quick-hack patching and more discussion.
>
> In particular, given that there is as yet no demonstrated effect other
> than mere warnings issued by a possibly-buggy gcc release, I think it's
> premature to be hacking our sources at all.
>

The warning certainly appears to be bogus in one case (the one from
psql/commands.c).

I was inder the impression, perhaps incorrectly, the casting the pointers to
(void *) would inhibit the compiler from making any assumptions about what
it pointed to, and hence inhibit bad effects from those assumptions. The
only way to know would be to examine the assembler output, I suppose. The
alternative is that it would merely inhibit the compiler from issuing a
warning and mask a bad effect. That would be nasty (and a much nastier bug
in gcc, IMNSHO).

Given your last paragraph and the above, I again suggest that the simplest
and safest course right now is to add -fno-strict-aliasing to the gcc flags.
I understand Bruce's concern that compiler issues only tend to get attention
late in the cycle, but ISTM there has been enough discussion on this for it
not to be dropped.

cheers

andrew



pgsql-hackers by date:

Previous
From: Michael Meskes
Date:
Subject: Re: Still not able to initdb
Next
From: Robert Treat
Date:
Subject: Re: http://www.pgsql.com/register/submit.php