<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">On Fri, Mar 22, 2013 at 10:05 PM, Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: timurrrr<br>
Date: Fri Mar 22 13:05:28 2013<br>
New Revision: 177745<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=177745&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=177745&view=rev</a><br>
Log:<br>
Band-aid fix for the Windows build caused by r177710. Long-term, atomic_compare_exchange_strong should be a template on Windows too...<br>
<br>
Modified:<br>
compiler-rt/trunk/lib/asan/asan_allocator2.cc<br>
<br>
Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=177745&r1=177744&r2=177745&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=177745&r1=177744&r2=177745&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)<br>
+++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Fri Mar 22 13:05:28 2013<br>
@@ -423,7 +423,8 @@ static void Deallocate(void *ptr, StackT<br>
<br>
u8 old_chunk_state = CHUNK_ALLOCATED;<br>
// Flip the chunk_state atomically to avoid race on double-free.<br>
- if (!atomic_compare_exchange_strong((atomic_uint8_t*)m, &old_chunk_state,<br>
+ if (!atomic_compare_exchange_strong((atomic_uintptr_t*)m,<br>
+ (uptr*)&old_chunk_state,<br>
CHUNK_QUARANTINE, memory_order_relaxed)) {<br>
if (old_chunk_state == CHUNK_QUARANTINE)<br>
ReportDoubleFree((uptr)ptr, stack);<br></blockquote><div><br></div><div style>Wait, you should atomically store one byte, not sizeof(uintptr_t). I think you will write some random garbage at address m in this way.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div>
</div></div>