public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: Richard Henderson <rth@redhat.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	    Jeff Law <law@redhat.com>
Subject: Re: [cxx-mem-model] disallow load data races (1 of some)
Date: Thu, 24 Mar 2011 21:51:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1103242148430.11151@digraph.polyomino.org.uk> (raw)
In-Reply-To: <4D8BB82F.3060901@redhat.com>

On Thu, 24 Mar 2011, Aldy Hernandez wrote:

> This work is independent of the C++ memory model.  It is just to prevent the
> optimizers from introducing new data races due to code movement. This initial
> pass is just to make the optimizations data race safe so that if you have a
> program which is proven to be free of data races, you can run the optimizers
> and it will still be data race free after the optimizers have been run.
> 
> See the following summary by Andrew (which in turn is based on a paper by Hans
> Boehm):
> 
> http://gcc.gnu.org/wiki/Atomic/GCCMM/DataRaces

But hoisting global in this case doesn't result in a data race, since the 
loop always accesses global and contains no synchronisation code.  If it 
were only accessed conditionally, as in the examples under "Avoiding 
Speculation" on that page, then there would be a race in hoisting it, but 
not for the code you gave; any data races with the hoisting would still 
have been present without it.

-- 
Joseph S. Myers
joseph@codesourcery.com

  reply	other threads:[~2011-03-24 21:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24 17:33 Aldy Hernandez
2011-03-24 19:58 ` Richard Henderson
2011-03-24 21:31   ` Aldy Hernandez
2011-03-24 21:51     ` Joseph S. Myers [this message]
2011-03-24 23:57       ` Andrew MacLeod
2011-03-25 10:03         ` Richard Guenther
2011-03-25 12:58           ` Aldy Hernandez
2011-03-25 15:27             ` Michael Matz
2011-03-25 15:33               ` Jeff Law
2011-03-25 15:35                 ` Jakub Jelinek
2011-03-25 15:46                   ` Richard Guenther
2011-03-29 16:52                     ` Aldy Hernandez
2011-03-31 13:12         ` Jeff Law
2011-03-31 13:32           ` Richard Guenther
2011-03-31 13:32             ` Jeff Law
2011-03-31 21:07               ` Michael Matz

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=Pine.LNX.4.64.1103242148430.11151@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=rth@redhat.com \
    /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).