From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28408 invoked by alias); 20 Sep 2004 13:31:35 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 28400 invoked from network); 20 Sep 2004 13:31:34 -0000 Received: from unknown (HELO sadr.equallogic.com) (66.155.203.134) by sourceware.org with SMTP; 20 Sep 2004 13:31:34 -0000 Received: from sadr.equallogic.com (localhost.localdomain [127.0.0.1]) by sadr.equallogic.com (8.12.8/8.12.8) with ESMTP id i8KDVYFn014472 for ; Mon, 20 Sep 2004 09:31:34 -0400 Received: from M30.equallogic.com (m30 [172.16.1.30]) by sadr.equallogic.com (8.12.8/8.12.8) with SMTP id i8KDVVsw014467; Mon, 20 Sep 2004 09:31:31 -0400 Received: from PKONING.equallogic.com ([172.16.1.105]) by M30.equallogic.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 20 Sep 2004 09:31:31 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16718.56242.559000.83791@gargle.gargle.HOWL> Date: Mon, 20 Sep 2004 13:57:00 -0000 From: Paul Koning To: tm_gccmail@kloo.net Cc: nathan@codesourcery.com, jamie@shareable.org, gcc@gcc.gnu.org Subject: Re: A question about "memory" clobbers in asm References: <414B0528.1040504@codesourcery.com> X-OriginalArrivalTime: 20 Sep 2004 13:31:31.0309 (UTC) FILETIME=[23DE61D0:01C49F16] X-SW-Source: 2004-09/txt/msg01164.txt.bz2 >>>>> "tm" == tm gccmail writes: tm> On Fri, 17 Sep 2004, Nathan Sidwell wrote: >> Jamie Lokier wrote: > I'm having trouble understand when it's >> appropriate to use a "memory" > clobber, when to use volatile, and >> when to use both. The manual is > unclear to me. Although I see >> that someone has tried to clarify it > since I last read it, it's >> still not obvious how "memory" is different > from `volatile'. >> >> my understanding is >> >> * volatile asm says something to the effect 'this changes state >> that you (the compiler) don't know about' -- such as writing to an >> IO port. >> >> * memory clobber says 'this asm will change memory, so don't cache >> anything across this asm'. tm> This definition of memory clobbers is incomplete. tm> A memory clobber is required when the inline assembly either tm> reads from or writes to arbitrary memory or both. Not just tm> "writes to". This means that the term "clobber" should be removed from the description because it is seriously misleading. paul