From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10834 invoked by alias); 14 Jan 2007 14:57:14 -0000 Received: (qmail 10816 invoked by uid 22791); 14 Jan 2007 14:57:08 -0000 X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.184) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 14 Jan 2007 14:57:00 +0000 Received: by nf-out-0910.google.com with SMTP id a25so1848264nfc for ; Sun, 14 Jan 2007 06:56:57 -0800 (PST) Received: by 10.82.152.16 with SMTP id z16mr427836bud.1168786617242; Sun, 14 Jan 2007 06:56:57 -0800 (PST) Received: by 10.82.150.13 with HTTP; Sun, 14 Jan 2007 06:56:56 -0800 (PST) Message-ID: <84fc9c000701140656i205d2480h1e6992adaa8f5efd@mail.gmail.com> Date: Sun, 14 Jan 2007 14:57:00 -0000 From: "Richard Guenther" To: "Eric Botcazou" Subject: Re: [PATCH] Tree SRA and atomicity/volatility Cc: gcc-patches@gcc.gnu.org In-Reply-To: <200701140850.31015.ebotcazou@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200701061422.39157.ebotcazou@adacore.com> <200701121500.12161.ebotcazou@adacore.com> <84fc9c000701120836r5cfd514fqdfcbd7addccb2ec@mail.gmail.com> <200701140850.31015.ebotcazou@adacore.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-01/txt/msg01165.txt.bz2 On 1/14/07, Eric Botcazou wrote: > > for this testcase (t02.original dump, gcc 4.1.2) . Now if I change the > > testcase to something I requested (direct write to a component), I get > > > > Q () > > { > > typedef q__byte q__byte; > > typedef struct q__word q__word; > > struct q__word T1b = {.first=0, .second=0, .third=0, .fourth=0}; > > struct q__word external = VIEW_CONVERT_EXPR(SAVE_EXPR > > ); > > > > VIEW_CONVERT_EXPR(external).first = 0; > > return; > > } > > You mean this I presume? > > External.First = 0; > > Then it is legal for the compiler to emit > > movb $0, -4(%ebp) > > because the object is not accessed "as a whole" in the source code (see the RM > quote in my first message). So my Ada ignorance shows here - so "atomicity" of External is only guaranteed for copies. Still there is nothing "clever" that gigi is doing - it's simply doing structure assignment (with some useless VIEW_CONVERT_EXPRs). I think you should represent this atomic access via a union. But I wonder for what this form of "atomicity" is used or useful. Richard.