public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: Dave Korn <dave.korn.cygwin@googlemail.com>
Cc: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: [4.3] Invalid code or invalid optimisation?
Date: Thu, 04 Jun 2009 08:27:00 -0000	[thread overview]
Message-ID: <4A27857D.50708@redhat.com> (raw)
In-Reply-To: <4A2728AA.3010205@gmail.com>

Dave Korn wrote:

>   Adding a "memory" clobber to the inline asm works around the problem,
> causing 4.3 series to generate the same assembly as head, but I think it's a
> sledgehammer approach.  Am I asking too much of GCC to not sink the store, or
> is 4.3 doing something wrong?  I /think/ that the fact that there's a volatile
> store in ilockcmpexch means the earlier store shouldn't be moved past it, and
> that GCC is perhaps missing that the asm's output operand effectively
> represents a volatile write through *t, but I could be misunderstanding the
> rules about volatile.  Anyone got their language lawyer's hat on at the moment?

You could just look at the standard, y'know.  Volatile stores only block other
volatile stores: they don't block *all* stores.  If you really want a complete
memory barrier, which in a mutex you surely do, then you're going to have to
clobber memory.

Andrew.

  reply	other threads:[~2009-06-04  8:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04  1:39 Dave Korn
2009-06-04  8:27 ` Andrew Haley [this message]
2009-06-04  9:22   ` Dave Korn
2009-06-04  9:48     ` Dave Korn
2009-06-04  9:57     ` Andrew Haley

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=4A27857D.50708@redhat.com \
    --to=aph@redhat.com \
    --cc=dave.korn.cygwin@googlemail.com \
    --cc=gcc@gcc.gnu.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).