Re: strict aliasing (was: const correctness)

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: pgsql-hackers@postgresql.org
Cc: Tom Lane <tgl@sss.pgh.pa.us>, "Kevin Grittner" <Kevin.Grittner@wicourts.gov>, "Robert Haas" <robertmhaas@gmail.com>, "Thomas Munro" <munro@ip9.org>, "Florian Pflug" <fgp@phlo.org>
Date: 2011-11-14T23:33:13Z
Lists: pgsql-hackers
On Monday, November 14, 2011 10:22:52 PM Tom Lane wrote:
> "Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> >> Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >>> Dunno ... where were the warnings exactly?
> > 
> > From HEAD checkout of a few minutes ago I now see only 9:
> Hmm ... well, none of those look likely to be in performance-sensitive
> areas.  But I wonder just how good the trouble-detection code is these
> days.
No idea about how good it is but you can make the detection code more 
aggressive by -Wstrict-aliasing=1 (which will produce more false positives).

I don't gcc will ever be able to call all possible misusages. E.g. The List 
api is a case where its basically impossible to catch everything (as gcc won't 
be able to figure out what the ListCell.data.ptr_value pointed to originally 
in the general case).

Andres