[compiler-rt] r191482 - tsan: support allocator_may_return_null flag
Kostya Serebryany
kcc at google.com
Fri Sep 27 01:01:50 PDT 2013
On Fri, Sep 27, 2013 at 10:15 AM, Dmitry Vyukov <dvyukov at google.com> wrote:
> we haven't decided how to do it: have 2 separate structs, derive one
>
in asan and msan we use two separate structs and it works well.
several other approaches may work too, but we really need to use *one* in
asan/tsan/msan
I've reopened https://code.google.com/p/thread-sanitizer/issues/detail?id=29
> from another, include one into another
>
> On Thu, Sep 26, 2013 at 10:46 PM, Kostya Serebryany <kcc at google.com>
> wrote:
> > What's the reason to introduce a copy of a flag instead of using the
> common
> > one as asan/msan do?
> >
> >
> > On Fri, Sep 27, 2013 at 6:31 AM, Dmitry Vyukov <dvyukov at google.com>
> wrote:
> >>
> >> Author: dvyukov
> >> Date: Thu Sep 26 21:31:23 2013
> >> New Revision: 191482
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=191482&view=rev
> >> Log:
> >> tsan: support allocator_may_return_null flag
> >> Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=29
> >>
> >>
> >> Modified:
> >> compiler-rt/trunk/lib/tsan/lit_tests/malloc_overflow.cc
> >> compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc
> >> compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h
> >>
> >> Modified: compiler-rt/trunk/lib/tsan/lit_tests/malloc_overflow.cc
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/malloc_overflow.cc?rev=191482&r1=191481&r2=191482&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/lib/tsan/lit_tests/malloc_overflow.cc (original)
> >> +++ compiler-rt/trunk/lib/tsan/lit_tests/malloc_overflow.cc Thu Sep 26
> >> 21:31:23 2013
> >> @@ -1,5 +1,3 @@
> >> -// XFAIL: *
> >> -// FIXME:
> https://code.google.com/p/thread-sanitizer/issues/detail?id=29
> >> // RUN: %clangxx_tsan -O1 %s -o %t
> >> // RUN: TSAN_OPTIONS=allocator_may_return_null=1 %t 2>&1 | FileCheck %s
> >> #include <stdio.h>
> >>
> >> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc?rev=191482&r1=191481&r2=191482&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc (original)
> >> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc Thu Sep 26 21:31:23
> 2013
> >> @@ -64,6 +64,7 @@ void InitializeFlags(Flags *f, const cha
> >> f->external_symbolizer_path = "";
> >> f->history_size = kGoMode ? 1 : 2; // There are a lot of goroutines
> in
> >> Go.
> >> f->io_sync = 1;
> >> + f->allocator_may_return_null = false;
> >>
> >> // Let a frontend override.
> >> OverrideFlags(f);
> >> @@ -95,6 +96,7 @@ void InitializeFlags(Flags *f, const cha
> >> ParseFlag(env, &f->external_symbolizer_path,
> >> "external_symbolizer_path");
> >> ParseFlag(env, &f->history_size, "history_size");
> >> ParseFlag(env, &f->io_sync, "io_sync");
> >> + ParseFlag(env, &f->allocator_may_return_null,
> >> "allocator_may_return_null");
> >>
> >> if (!f->report_bugs) {
> >> f->report_thread_leaks = false;
> >> @@ -113,6 +115,8 @@ void InitializeFlags(Flags *f, const cha
> >> " (must be [0..2])\n");
> >> Die();
> >> }
> >> +
> >> + common_flags()->allocator_may_return_null =
> >> f->allocator_may_return_null;
> >> }
> >>
> >> } // namespace __tsan
> >>
> >> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h?rev=191482&r1=191481&r2=191482&view=diff
> >>
> >>
> ==============================================================================
> >> --- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h (original)
> >> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h Thu Sep 26 21:31:23 2013
> >> @@ -92,6 +92,8 @@ struct Flags {
> >> // 1 - reasonable level of synchronization (write->read)
> >> // 2 - global synchronization of all IO operations
> >> int io_sync;
> >> + // If false, the allocator will crash instead of returning 0 on
> >> out-of-memory.
> >> + bool allocator_may_return_null;
> >> };
> >>
> >> Flags *flags();
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130927/afc7bc16/attachment.html>
More information about the llvm-commits
mailing list