This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [cxx-mem-model] disallow load data races (1 of some)


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]