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

Kostya Serebryany kcc at google.com
Mon Dec 5 11:04:33 PST 2011


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111205/5af341d9/attachment.html>


More information about the llvm-commits mailing list