From owner-freebsd-arch@FreeBSD.ORG Wed Sep 19 13:07:22 2012 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 402A7106566B for ; Wed, 19 Sep 2012 13:07:22 +0000 (UTC) (envelope-from sdaoden@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id C0F8C8FC14 for ; Wed, 19 Sep 2012 13:07:21 +0000 (UTC) Received: by weyx56 with SMTP id x56so675074wey.13 for ; Wed, 19 Sep 2012 06:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:in-reply-to :user-agent:mime-version:content-type:content-transfer-encoding; bh=0kxdh96LmEah2og7wGTOS1E7PyJIRuqA6+wuo8zgUB0=; b=pznW9CbbGh/P+rJljgQNj/N53SPA8PrB0e7YFSBmZQrNIo3EpfcY/B95+u65mtW/pb 5Mau1rEe7jnNZiWVuPe9gUMtyZyoFVReF0K+FcMxJT3yy4GYJnLTMl6dDjy4jR2Z+JT7 qRArFbVAKjVTzidc5YrFKEGxzm4URYyYcaYeE2/y4AjrjynZRDB1QVHFWKsa6rm+/Sqy ADLt50zj0HP+UteJnvDUxzoizRgT5zR4Yuf/6PESRrB6Ff68k7AyjKjoOB9H0ne/cSEx 1z62wHdylSDtcMR2+pohi4gW5YYlO2C+uqGaEdW6IX5e8/f9JpPyWP210RO+d39ASig1 N18w== Received: by 10.216.197.104 with SMTP id s82mr1666730wen.62.1348060040449; Wed, 19 Sep 2012 06:07:20 -0700 (PDT) Received: from dietcurd.wild-life.local ([89.204.130.4]) by mx.google.com with ESMTPS id v3sm27645497wiw.7.2012.09.19.06.07.17 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Sep 2012 06:07:18 -0700 (PDT) Date: Wed, 19 Sep 2012 15:07:13 +0200 From: Steffen "Daode" Nurpmeso To: John-Mark Gurney Message-ID: <5059c381.NQi8ZjRVtmejDJ8YX5Um3ADA@dietcurd.wild-life.local> References: <95608.1347973160@critter.freebsd.dk> <20120918233002.GE19036@funkthat.com> In-Reply-To: <20120918233002.GE19036@funkthat.com> User-Agent: S-nail <12.5 7/5/10; s-nail-14-g99de6dd> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: arch@freebsd.org, Poul-Henning Kamp Subject: Re: Aliasing issue with TAILQ on ppc64 ? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2012 13:07:22 -0000 John-Mark Gurney 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