[compiler-rt] r177745 - Band-aid fix for the Windows build caused by r177710. Long-term, atomic_compare_exchange_strong should be a template on Windows too...

Alexey Samsonov samsonov at google.com
Mon Mar 25 03:40:38 PDT 2013


I think this should be fixed by r177854.


On Fri, Mar 22, 2013 at 10:18 PM, Timur Iskhodzhanov <timurrrr at google.com>wrote:

> OK, reverted then...
> Can you please help fix the Windows build caused by r177710?
>
> 2013/3/22 Alexey Samsonov <samsonov at google.com>:
> >
> > On Fri, Mar 22, 2013 at 10:05 PM, Timur Iskhodzhanov <
> timurrrr at google.com>
> > wrote:
> >>
> >> Author: timurrrr
> >> Date: Fri Mar 22 13:05:28 2013
> >> New Revision: 177745
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=177745&view=rev
> >> Log:
> >> Band-aid fix for the Windows build caused by r177710. Long-term,
> >> atomic_compare_exchange_strong should be a template on Windows too...
> >>
> >> Modified:
> >>     compiler-rt/trunk/lib/asan/asan_allocator2.cc
> >>
> >> Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=177745&r1=177744&r2=177745&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)
> >> +++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Fri Mar 22 13:05:28
> 2013
> >> @@ -423,7 +423,8 @@ static void Deallocate(void *ptr, StackT
> >>
> >>    u8 old_chunk_state = CHUNK_ALLOCATED;
> >>    // Flip the chunk_state atomically to avoid race on double-free.
> >> -  if (!atomic_compare_exchange_strong((atomic_uint8_t*)m,
> >> &old_chunk_state,
> >> +  if (!atomic_compare_exchange_strong((atomic_uintptr_t*)m,
> >> +                                      (uptr*)&old_chunk_state,
> >>                                        CHUNK_QUARANTINE,
> >> memory_order_relaxed)) {
> >>      if (old_chunk_state == CHUNK_QUARANTINE)
> >>        ReportDoubleFree((uptr)ptr, stack);
> >
> >
> > 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.
> >
> >>
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> >
> >
> >
> > --
> > Alexey Samsonov, MSK
>



-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130325/957e4b4b/attachment.html>


More information about the llvm-commits mailing list