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

Michael Matz matz@suse.de
Fri Mar 25 15:27:00 GMT 2011


Hi,

On Fri, 25 Mar 2011, Aldy Hernandez wrote:

> > But speculative loads are never a problem.  So I'd like to avoid 
> > cluttering GCC code with stuff to avoid them.  I honestly don't care 
> > about diagnostic tools that fail to see if a value read is used or 
> > not.
> 
> Frankly, I agree.  The standard (and the aforementioned paper) says that 
> load data races are disallowed...
> 
> "If we had hypothetical hardware (or a virtual machine) that aborted the
> program when a race was detected, compilers would not be allowed to introduce
> potentially racing loads... even if the result of the load were unused would
> change the semantics of the program. Although such environments are not
> commonplace, they have certainly been proposed, and may well turn out to be
> very useful."
> 
> ...but, if there's no hardware for it, I see no need for spending time on
> this.

Even if there was such (IMO useless) hardware, or somebody would waste his 
time in writing such (equally useless) virtual machine that can detect 
fabricated problems somebody invented for some standard that never are 
going to be problems in the real world, we shouldn't feel obliged to 
uglify GCC for that.

(OTOH my opinion about the new c++ memory model is known ;) )


Ciao,
Michael.



More information about the Gcc-patches mailing list