<br><br><div class="gmail_quote">On Tue, Mar 20, 2012 at 1:50 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
On Mar 20, 2012, at 12:51 AM, Duncan Sands wrote:<br>
<br>
>>> Using instruction level metadata for this would be appropriate.  However, I<br>
>>> also don't understand why a race on this is truly benign.<br>
>><br>
>> It isn't, really; calling it "benign" is deceptive.  It's just that<br>
>> storing a pointer which is equal to the existing pointer stored at a<br>
>> given address almost always makes the optimizer/codegen generate code<br>
>> which can't trigger the race in a way which visibly misbehaves.<br>
>> Therefore, as a heuristic users apparently want ThreadSanitizer to<br>
>> ignore (or list separately) such races.<br>
><br>
> The gcc Ada front-end does this too, in quite a range of situations.  For<br>
> example multiple threads racily initialize a pointer variable, but they all<br>
> initialize to the same value.  The various valgrind based race detection<br>
> tools all complain about this, which makes them much less useful than they<br>
> might be for Ada.<br>
<br>
</div>FWIW, after thinking about this for awhile, I realize that we already have the tools to handle this: TBAA.<br>
<br>
It would be general goodness for clang to emit VTable loads and stores in their with their own TBAA type class (one that does not even alias "char*"). </blockquote><div><br></div><div>Indeed, sounds very nice.</div>
<div>I'll try to make a patch that adds TBAA metadata to VTable loads (unless someone else knows how to do it off the top of his head). </div><div><br></div><div>Thanks! </div><div><br></div><div>--kcc </div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> This would give us improved code quality, is straight-forward to reason about, is not "another knob" and would be a really easy for ASAN to use.<br>

<br>
One issue is that TBAA is disabled in -O0 builds: I'd just make vtable TBAA information be produced when the optimizer is enabled or if ASAN is enabled.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Chris<br>
<br>
</font></span></blockquote></div><br>