Re: strict aliasing (was: const correctness) - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: strict aliasing (was: const correctness)
Date
Msg-id 20111114224419.GC29764@svana.org
Whole thread Raw
In response to Re: strict aliasing (was: const correctness)  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
On Mon, Nov 14, 2011 at 06:25:19PM -0300, Alvaro Herrera wrote:
> > All 10 were like this:
> >
> >   warning: dereferencing type-punned pointer will break
> >     strict-aliasing rules
>
> Uhm, shouldn't we expect there to be one warning for each use of a Node
> using some specific node pointer type as well as something generic such
> as inside a ListCell etc?

Maybe they're safe? But in any case given the use of Node, a may be an
idea to mark it with attribute((__may_alias__)), that should clear up
most of the problems in that area.

http://ohse.de/uwe/articles/gcc-attributes.html#type-may_alias

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts.  -- Arthur Schopenhauer

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Detach/attach database
Next
From: Ross Reedstrom
Date:
Subject: Re: feature request: auto savepoint for interactive psql when in transaction.