From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5092 invoked by alias); 17 Sep 2004 14:50:15 -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 5084 invoked from network); 17 Sep 2004 14:50:15 -0000 Received: from unknown (HELO yosemite.airs.com) (209.128.65.135) by sourceware.org with SMTP; 17 Sep 2004 14:50:15 -0000 Received: (qmail 17116 invoked by uid 10); 17 Sep 2004 14:50:14 -0000 Received: (qmail 30140 invoked by uid 500); 17 Sep 2004 14:50:05 -0000 From: Ian Lance Taylor To: Jamie Lokier Cc: gcc@gcc.gnu.org Subject: Re: A question about "memory" clobbers in asm References: <20040917144519.GB31970@mail.shareable.org> Date: Fri, 17 Sep 2004 15:39:00 -0000 In-Reply-To: <20040917144519.GB31970@mail.shareable.org> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-09/txt/msg01066.txt.bz2 Jamie Lokier writes: Should this be on gcc-help? > 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'. Volatile means that the assembler instruction can not be deleted, even if it appears to be useless. Marking the instruction as clobbering memory means that if the instruction is executed, then memory is clobbered in some undescribed way. However, that clobbering is not important to proper execution of the program, and the instruction can be deleted if the specified side-effects turn out to be unnecessary. At least, that is my understanding. Ian