This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [cxx-mem-model] disallow load data races (1 of some)
- From: Richard Henderson <rth at redhat dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Jeff Law <law at redhat dot com>
- Date: Thu, 24 Mar 2011 12:58:48 -0700
- Subject: Re: [cxx-mem-model] disallow load data races (1 of some)
- References: <4D8B8051.2030307@redhat.com>
On 03/24/2011 10:33 AM, Aldy Hernandez wrote:
> In the example below we usually hoist "global" into a register or
> temporary to avoid reading from it at each step. This would cause a
> race if another thread had modified "global" in between iterations.
>
> for (x=0; x< 5; x++)
> sum[x] = global;
Um, what? Doesn't the c++ memory model have, like, sequence points
or somesuch verbage that includes some language like an "atomic"?
Your argument above, in absence of some serializing entity, does not
sound right at all.
r~