public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@wasabisystems.com>
To: Jamie Lokier <jamie@shareable.org>
Cc: gcc@gcc.gnu.org
Subject: Re: A question about "memory" clobbers in asm
Date: Fri, 17 Sep 2004 15:39:00 -0000	[thread overview]
Message-ID: <m3hdpx6jc2.fsf@gossamer.airs.com> (raw)
In-Reply-To: <20040917144519.GB31970@mail.shareable.org>

Jamie Lokier <jamie@shareable.org> 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

  reply	other threads:[~2004-09-17 14:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-17 15:32 Jamie Lokier
2004-09-17 15:39 ` Ian Lance Taylor [this message]
2004-09-17 15:50   ` Jamie Lokier
2004-09-17 16:07 ` Nathan Sidwell
2004-09-17 18:02   ` Jamie Lokier
2004-09-18  1:52     ` Giovanni Bajo
2004-09-18 17:10       ` Jamie Lokier
2004-09-18 20:48         ` Giovanni Bajo
2004-09-20  7:37   ` tm_gccmail
2004-09-20 13:57     ` Paul Koning
2004-09-20 15:16     ` Dave Korn
2004-09-20 15:39       ` Nathan Sidwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3hdpx6jc2.fsf@gossamer.airs.com \
    --to=ian@wasabisystems.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jamie@shareable.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).