<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Sep 27, 2013 at 10:15 AM, Dmitry Vyukov <span dir="ltr"><<a href="mailto:dvyukov@google.com" target="_blank">dvyukov@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">we haven't decided how to do it: have 2 separate structs, derive one<br>
</blockquote><div><br></div><div>in asan and msan we use two separate structs and it works well. </div><div>several other approaches may work too, but we really need to use *one* in asan/tsan/msan</div><div>I've reopened <a href="https://code.google.com/p/thread-sanitizer/issues/detail?id=29">https://code.google.com/p/thread-sanitizer/issues/detail?id=29</a></div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
from another, include one into another<br>
<div class=""><div class="h5"><br>
On Thu, Sep 26, 2013 at 10:46 PM, Kostya Serebryany <<a href="mailto:kcc@google.com">kcc@google.com</a>> wrote:<br>
> What's the reason to introduce a copy of a flag instead of using the common<br>
> one as asan/msan do?<br>
><br>
><br>
> On Fri, Sep 27, 2013 at 6:31 AM, Dmitry Vyukov <<a href="mailto:dvyukov@google.com">dvyukov@google.com</a>> wrote:<br>
>><br>
>> Author: dvyukov<br>
>> Date: Thu Sep 26 21:31:23 2013<br>
>> New Revision: 191482<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=191482&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=191482&view=rev</a><br>
>> Log:<br>
>> tsan: support allocator_may_return_null flag<br>
>> Fixes <a href="https://code.google.com/p/thread-sanitizer/issues/detail?id=29" target="_blank">https://code.google.com/p/thread-sanitizer/issues/detail?id=29</a><br>
>><br>
>><br>
>> Modified:<br>
>>     compiler-rt/trunk/lib/tsan/lit_tests/malloc_overflow.cc<br>
>>     compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc<br>
>>     compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h<br>
>><br>
>> Modified: compiler-rt/trunk/lib/tsan/lit_tests/malloc_overflow.cc<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/malloc_overflow.cc?rev=191482&r1=191481&r2=191482&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/malloc_overflow.cc?rev=191482&r1=191481&r2=191482&view=diff</a><br>

>><br>
>> ==============================================================================<br>
>> --- compiler-rt/trunk/lib/tsan/lit_tests/malloc_overflow.cc (original)<br>
>> +++ compiler-rt/trunk/lib/tsan/lit_tests/malloc_overflow.cc Thu Sep 26<br>
>> 21:31:23 2013<br>
>> @@ -1,5 +1,3 @@<br>
>> -// XFAIL: *<br>
>> -// FIXME: <a href="https://code.google.com/p/thread-sanitizer/issues/detail?id=29" target="_blank">https://code.google.com/p/thread-sanitizer/issues/detail?id=29</a><br>
>>  // RUN: %clangxx_tsan -O1 %s -o %t<br>
>>  // RUN: TSAN_OPTIONS=allocator_may_return_null=1 %t 2>&1 | FileCheck %s<br>
>>  #include <stdio.h><br>
>><br>
>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc?rev=191482&r1=191481&r2=191482&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc?rev=191482&r1=191481&r2=191482&view=diff</a><br>

>><br>
>> ==============================================================================<br>
>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc (original)<br>
>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc Thu Sep 26 21:31:23 2013<br>
>> @@ -64,6 +64,7 @@ void InitializeFlags(Flags *f, const cha<br>
>>    f->external_symbolizer_path = "";<br>
>>    f->history_size = kGoMode ? 1 : 2;  // There are a lot of goroutines in<br>
>> Go.<br>
>>    f->io_sync = 1;<br>
>> +  f->allocator_may_return_null = false;<br>
>><br>
>>    // Let a frontend override.<br>
>>    OverrideFlags(f);<br>
>> @@ -95,6 +96,7 @@ void InitializeFlags(Flags *f, const cha<br>
>>    ParseFlag(env, &f->external_symbolizer_path,<br>
>> "external_symbolizer_path");<br>
>>    ParseFlag(env, &f->history_size, "history_size");<br>
>>    ParseFlag(env, &f->io_sync, "io_sync");<br>
>> +  ParseFlag(env, &f->allocator_may_return_null,<br>
>> "allocator_may_return_null");<br>
>><br>
>>    if (!f->report_bugs) {<br>
>>      f->report_thread_leaks = false;<br>
>> @@ -113,6 +115,8 @@ void InitializeFlags(Flags *f, const cha<br>
>>             " (must be [0..2])\n");<br>
>>      Die();<br>
>>    }<br>
>> +<br>
>> +  common_flags()->allocator_may_return_null =<br>
>> f->allocator_may_return_null;<br>
>>  }<br>
>><br>
>>  }  // namespace __tsan<br>
>><br>
>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h?rev=191482&r1=191481&r2=191482&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h?rev=191482&r1=191481&r2=191482&view=diff</a><br>

>><br>
>> ==============================================================================<br>
>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h (original)<br>
>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h Thu Sep 26 21:31:23 2013<br>
>> @@ -92,6 +92,8 @@ struct Flags {<br>
>>    // 1 - reasonable level of synchronization (write->read)<br>
>>    // 2 - global synchronization of all IO operations<br>
>>    int io_sync;<br>
>> +  // If false, the allocator will crash instead of returning 0 on<br>
>> out-of-memory.<br>
>> +  bool allocator_may_return_null;<br>
>>  };<br>
>><br>
>>  Flags *flags();<br>
>><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>
><br>
><br>
</div></div></blockquote></div><br></div></div>