Aliasing issue with TAILQ on ppc64 ?

John-Mark Gurney jmg at funkthat.com
Tue Sep 18 23:30:09 UTC 2012


Poul-Henning Kamp wrote this message on Tue, Sep 18, 2012 at 12:59 +0000:
> It may be a good idea to find some way to make sure the compiler
> spots the potential aliasing, but I am not sufficiently up to
> date on compiler optimizations to know a safe and reliable way
> to do that. (Would explicitly casting throuh a void do it ?)

Try casting the access through a char pointer.  The C99 spec states
that you can only access an object through a pointer that is type
compatible, or through a char type, though, it isn't clear that from
the C99 spec that casting through a char type is enough to break
the aliasing...

I'm waiting for an answer from a friend who knows this much better
than myself...

The relevant part of the C99 standard is section 6.5, paragraphs 6 & 7...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the freebsd-arch mailing list