[llvm-commits] AddressSanitizer GCD tests on Mac: prevent optimization, enable.

Kostya Serebryany kcc at google.com
Tue Dec 6 11:14:05 PST 2011


r145953

On Tue, Dec 6, 2011 at 3:04 AM, Alexander Potapenko <glider at google.com>wrote:

> Including asan_test_utils.h is not possible, because 'extern "C"' and
> 'template' is not valid ObjC code.
> Let it be volatile, otherwise we'll need to write a separate
> asan_test_utils for ObjC, which'll be an overkill.
>
> On Mon, Dec 5, 2011 at 11:04 PM, Kostya Serebryany <kcc at google.com> wrote:
> > I wonder if you can reuse Ident() from tests/asan_test_utils.h instead of
> > using volatile.
> > Like this:
> >   char *mem = Ident(malloc(10));
> >
> > // This function returns its parameter but in such a way that compiler
> >
> >
> > // can not prove it.
> >
> >
> > template<class T>
> >
> >
> > __attribute__((noinline))
> >
> >
> > static T Ident(T t) {
> > ...
> >
> >
> > --kcc
> >
> >
> > On Mon, Dec 5, 2011 at 12:44 AM, Alexander Potapenko <glider at google.com>
> > wrote:
> >>
> >> Fix GCD tests for AddressSanitizer on Mac.
> >> The following patch declares the char* vars holding the memory
> >> allocations as volatile, which prevents the compiler from optimizing
> >> them and breaking the tests.
> >> I'm also enabling the tests by default, as the GCD support in ASan
> >> runtime library is quite stable already.
> >>
> >> --
> >> Alexander Potapenko
> >> Software Engineer
> >> Google Moscow
> >
> >
>
>
>
> --
> Alexander Potapenko
> Software Engineer
> Google Moscow
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111206/642240b7/attachment.html>


More information about the llvm-commits mailing list