Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Sep 2012 15:07:13 +0200
From:      Steffen "Daode" Nurpmeso <sdaoden@gmail.com>
To:        John-Mark Gurney <jmg@funkthat.com>
Cc:        arch@freebsd.org, Poul-Henning Kamp <phk@phk.freebsd.dk>
Subject:   Re: Aliasing issue with TAILQ on ppc64 ?
Message-ID:  <5059c381.NQi8ZjRVtmejDJ8YX5Um3ADA@dietcurd.wild-life.local>
In-Reply-To: <20120918233002.GE19036@funkthat.com>
References:  <95608.1347973160@critter.freebsd.dk> <20120918233002.GE19036@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
John-Mark Gurney <jmg@funkthat.com> wrote:

 |Poul-Henning Kamp wrote this message on Tue, Sep 18, 2012 at 12:59 +0=
000:
 |> 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 ?)
 [.]
 |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...

A good rant is on
  http://blog.qt.digia.com/2011/06/10/type-punning-and-strict-aliasing/=
.
Down in the comments, as a reply from the original poster of it:

  Pay attention to what I said and quoted: without the
  strict-aliasing guarantee, the compiler cannot replace the 10000
  4-byte sets with one 40000-byte memset.

Isn't that just horrible?
For me, when i want to optimize a loop into a memset, i optimize
a loop into a memset, and have some fun to see how it performs
thereafter.  I'll surely have to rework a *lot* of code.

  It=E2=80=99s quite scary because it says this *will* break stuff.

Unbelievable that they simply threw that onto all that code that
had been written before, instead of applying it to types and
pointers that were explicitly declared to be compatible.
Article is worth reading.

--steffen



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