Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Sep 2012 16:30:02 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        arch@freebsd.org
Subject:   Re: Aliasing issue with TAILQ on ppc64 ?
Message-ID:  <20120918233002.GE19036@funkthat.com>
In-Reply-To: <95608.1347973160@critter.freebsd.dk>
References:  <95608.1347973160@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
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."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120918233002.GE19036>